home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 21 / Mac Magazin and MacEasy Magazine CD - Issue 21.iso / Wissenschaft & Technik / yorick_docs folder / yorick_docs / std.doc < prev    next >
Text File  |  1996-02-28  |  122KB  |  2,643 lines

  1.  
  2.  
  3.  
  4.                           Yorick Documentation
  5.                 for functions, variables, and structures
  6.                          defined in file std.i
  7.                    Printed: Fri Feb  9 08:29:21 1996
  8.  
  9.    Contents:
  10.  
  11.    _                   collect             is_range            save
  12.    _car                conj                is_stream           sech
  13.    _cat                copyright           is_struct           set_blocksize
  14.    _cdr                cos                 is_void             set_filesize
  15.    _cpy                cosh                jc                  set_idler
  16.    _init_clog          cray_primitives     jr                  set_path
  17.    _init_pdb           create              jt                  show
  18.    _jc                 createb             legal               sign
  19.    _jr                 data_align          library             sin
  20.    _jt                 dbauto              log                 sinh
  21.    _len                dbcont              log10               sizeof
  22.    _lst                dbdis               mac_primitives      sort
  23.    _map                dbexit              macl_primitives     span
  24.    _not_cdf            dbinfo              max                 spanl
  25.    _not_pdb            dbret               median              sqrt
  26.    _nxt                dbskip              merge               sread
  27.    _prt                dbup                merge2              strlen
  28.    _read               dec_primitives      min                 strmatch
  29.    _rev                digitize            nallof              strpart
  30.    _set_pdb            dimsof              nameof              strtok
  31.    _write              disassemble         noneof              struct_align
  32.    abs                 dump_clog           numberof            structof
  33.    acos                edit_times          open                sum
  34.    add_member          eq_nocopy           open102             sun3_primitives
  35.    add_next_file       error               openb               sun_primitives
  36.    add_record          exit                openb_hooks         swrite
  37.    add_variable        exp                 orgsof              symbol_def
  38.    allof               floor               pc_primitives       symbol_set
  39.    alpha_primitives    get_addrs           pi                  system
  40.    am_subroutine       get_argv            poly                tan
  41.    anyof               get_cwd             pr1                 tanh
  42.    area                get_env             print               timer
  43.    array               get_home            print_format        timer_print
  44.    asin                get_member          process_argv        timestamp
  45.    asinh               get_ncycs           ptcen               transpose
  46.    at_pdb_close        get_times           quit                typeof
  47.    at_pdb_open         get_vars            random              uncen
  48.    atan                grow                random_seed         updateb
  49.    avg                 has_records         randomize           use_origins
  50.    backup              help                rdline              vax_primitives
  51.    batch               histogram           read                vaxg_primitives
  52.    bookmark            include             read_clog           volume
  53.    call                indgen              read_n              warranty
  54.    catch               info                recover_file        where
  55.    cd                  install_struct      remove              where2
  56.    ceil                integ               rename              write
  57.    close               interp              require             xdr_primitives
  58.    close102            is_array            reshape             yorick_stats
  59.    close102_default    is_func             restore             zncen
  60.  
  61.                                                              FROM _ TO _len
  62.  
  63.                                                                           _
  64.     /* SEE grow     */
  65.  
  66.                                                                        _car
  67.     /* SEE _lst     */
  68.  
  69.                                                                        _cat
  70.     /* SEE _lst     */
  71.  
  72.                                                                        _cdr
  73.     /* SEE _lst     */
  74.  
  75.                                                                        _cpy
  76.     /* SEE _lst     */
  77.  
  78.                                                                  _init_clog
  79. /* DOCUMENT _init_clog, file
  80.      initializes a Clog binary file.  Used after creating a new file --
  81.      must be called AFTER the primitive data formats have been set.
  82.  */
  83.  
  84.                                                                   _init_pdb
  85. /* DOCUMENT _init_pdb, file, at_pdb_close
  86.             _set_pdb, file, at_pdb_close
  87.      initializes a PDB binary file.  Used after creating a new file --
  88.      must be called AFTER the primitive data formats have been set.
  89.      The _set_pdb call only sets the CloseHook, on the assumption that
  90.      the file header has already been written (as in recover_file).
  91.    SEE ALSO: createb, recover_file, at_pdb_close
  92.  */
  93.  
  94.                                                                         _jc
  95.     /* SEE _jr     */
  96.  
  97.                                                                         _jr
  98. /* DOCUMENT _jt, file, time
  99.             _jc, file, ncyc
  100.         _jr, file
  101.      are raw versions of jt and jc provided to simplify redefining
  102.      the default jt and jc functions to add additional features.
  103.      For example, you could redefine jt to jump to a time, then
  104.      plot something.  The new jt can pass its arguments along to
  105.      _jt, then call the appropriate plotting functions.
  106.      There is a raw version of jr as well.
  107.  */
  108.  
  109.                                                                         _jt
  110.     /* SEE _jr     */
  111.  
  112.                                                                        _len
  113.     /* SEE _lst     */
  114.  
  115.                                                           FROM _lst TO _lst
  116.  
  117.                                                                        _lst
  118. /* DOCUMENT list= _lst(item1, item2, item3, ...)
  119.             list= _cat(item_or_list1, item_or_list2, item_or_list3, ...)
  120.         list= _cpy(list)
  121.           list= _cpy(list, i)
  122.         length= _len(list)
  123.             item= _car(list)
  124.               item_i= _car(list, i)
  125.               _car, list, i, new_item_i
  126.         list= _cdr(list)
  127.           list= _cdr(list, i)
  128.               _cdr, list, i, new_list_i
  129.  
  130.      implement rudimentary Lisp-like list handling in Yorick.
  131.      However, in Yorick, a list must have a simple tree structure
  132.      - no loops or rings are allowed (loops break Yorick's memory
  133.      manager - beware).  You need to be careful not to do this as
  134.      the error will not be detected.
  135.  
  136.      Lists are required in Yorick whenever you need to hold an
  137.      indeterminate amount of non-array data, such as file handles,
  138.      bookmarks, functions, index ranges, etc.  Note that Yorick
  139.      pointers cannot point to these objects.  For array data, you have
  140.      a choice between a list and a struct or an array of pointers.
  141.      Note that a list cannot be written into a file with the save
  142.      function, since it may contain unsaveable items.
  143.  
  144.      The _lst (list), _cat (catenate), and _cpy (copy) functions
  145.      are the principal means for creating and maintaining lists.
  146.      _lst makes a list out of its arguments, so that each argument
  147.      becomes one item of the new list.  Unlike Yorick array data
  148.      types, a statement like x=list does not make a copy of the
  149.      list, it merely makes an additional reference to the list.
  150.      You must explicitly use the _cpy function to copy a list.  Note
  151.      that _cpy only copies the outermost list itself, not the items
  152.      in the list (even if those items are lists).  With the second
  153.      argument i, _cpy copies only the first i items in the list.
  154.      The _cat function concatentates several lists together,
  155.      "promoting" any arguments which are not lists.  This operation
  156.      changes the values of list arguments to _cat, except for the
  157.      final argument, since after _cat(list, item), the variable list
  158.      will point to the new longer list returned by _cat.
  159.  
  160.      Nil, or [], functions as an empty list.  This leads to ambiguity
  161.      in the argument list for _cat, since _cat "promotes" non-list
  162.      arguments to lists; _cat treats [] as an empty list, not as a
  163.      non-list item.  Also, _lst() or _lst([]) returns a single item list,
  164.      not [] itself.
  165.  
  166.      The _len function returns the number of items in a list, or 0
  167.      for [].
  168.  
  169.      The _car and _cdr functions (the names are taken from Lisp,
  170.      where they originally stood for something like "address register"
  171.      and "data register" of some long forgotten machine) provide
  172.  
  173.                                                           FROM _lst TO _nxt
  174.  
  175.      access to the items stored in a list.  _car(list,i) returns the
  176.      i-th item of the list, and i defaults to 1, so _car(list) is the
  177.      first item.  Also, _car,list,i,new_item_i sets the i-th item
  178.      of the list.  Finally, _cdr(list,i) returns a list of all the
  179.      items beyond the i-th, where i again defaults to 1.  The form
  180.      _cdr,list,i,new_list_i can be used to reset all list items
  181.      beyond the i-th to new values.  In the _cdr function, i=0 is
  182.      allowed.  When used to set values, both _car and _cdr can also
  183.      be called as functions, in which case they return the item or
  184.      list which has been replaced.  The _cdr(list) function returns
  185.      nil if and only if LIST contains only a single item; this is
  186.      the usual means of halting a loop over items in a list.
  187.  
  188.    SEE ALSO: array, grow, _prt, _map, _rev, _nxt
  189.  */
  190.  
  191.                                                                        _map
  192. /* DOCUMENT _map(f, list)
  193.      return a list of the results of applying function F to each
  194.      element of the input LIST in turn, as if by
  195.        _lst(f(_car(list,1)),f(_car(list,2)),...)
  196.    SEE ALSO: _lst
  197.  */
  198.  
  199.                                                                    _not_cdf
  200. /* DOCUMENT _not_cdf(file)
  201.      is like _not_pdb, but for netCDF files.
  202.  */
  203.  
  204.                                                                    _not_pdb
  205. /* DOCUMENT _not_pdb(file, familyOK)
  206.      returns 1 if FILE is not a PDB file, otherwise returns 0 after
  207.      setting the structure and data tables, and cataloguing any
  208.      history records.  Used to open an existing file.  Also detects
  209.      a file with an appended Clog description.
  210.      Before calling _not_pdb, set the variable yPDBopen to the value
  211.      of at_pdb_open you want to be in force.  (For historical reasons
  212.      -- in order to allow for the open102 keyword to openb -- _not_pdb
  213.      looks at the value of the variable yPDBopen, rather than at_pdb_open
  214.      directly.)
  215.  */
  216.  
  217.                                                                        _nxt
  218. /* DOCUMENT item= _nxt(list)
  219.      return first item in LIST, and set LIST to list of remaining
  220.      items.  If you are iterating through a list, this is the way
  221.      to do it, since a loop on _car(list,i) with i varying from 1
  222.      to _len(list) scales quadratically with the length of the list,
  223.      while a loop on _nxt(list) scales linearly.
  224.    SEE ALSO: _car, _lst
  225.  */
  226.  
  227.                                                           FROM _prt TO acos
  228.  
  229.                                                                        _prt
  230. /* DOCUMENT _prt, list
  231.      print every item in a list, recursing if some item is itself a list.
  232.    SEE ALSO: _lst
  233.  */
  234.  
  235.                                                                       _read
  236. /* DOCUMENT _write, file, address, expression
  237.             _read, file, address, variable
  238.      or nbytes= _read(file, address, variable);
  239.      are low level read and write functions which do not "see" the
  240.      symbol table for the binary FILE.  The ADDRESS is the byte address
  241.      at which to begin the write or read operation.  The type and number
  242.      of objects of the EXPRESSION or VARIABLE determines how much data
  243.      to read, and what format conversion operations to apply.  In the
  244.      case of type char, no conversion operations are ever applied, and
  245.      _read will return the actual number of bytes read, which may be
  246.      fewer than the number implied by VARIABLE in this one case.
  247.      (In all other cases, _read returns numberof(VARIABLE).)
  248.      If the FILE has records, the ADDRESS is understood to be in the
  249.      file family member in which the current record resides.
  250.    SEE ALSO: openb, createb, updateb, save, restore, sizeof
  251.  */
  252.  
  253.                                                                        _rev
  254. /* DOCUMENT _rev(list)
  255.      returns the input list in reverse order
  256.    SEE ALSO: _lst
  257.  */
  258.  
  259.                                                                    _set_pdb
  260.     /* SEE _init_pdb     */
  261.  
  262.                                                                      _write
  263.     /* SEE _read     */
  264.  
  265.                                                                         abs
  266. /* DOCUMENT abs(x)
  267.          or abs(x, y, z, ...)
  268.      returns the absolute value of its argument.
  269.      In the multi-argument form, returns sqrt(x^2+y^2+z^2+...).
  270.   SEE ALSO: sign, sqrt, also note the rms range function
  271.  */
  272.  
  273.                                                                        acos
  274. /* DOCUMENT acos(x)
  275.      returns the inverse cosine of its argument, range [0, pi].
  276.   SEE ALSO: sin, cos, tan, asin, acos, atan
  277.  */
  278.  
  279.                                               FROM add_member TO add_record
  280.  
  281.                                                                  add_member
  282. /* DOCUMENT add_member, file, struct_name, offset, name, type, dimlist
  283.      adds a member to a data type in the file FILE.  The data type name
  284.      (struct name) is STRUCT_NAME, which will be created if it does
  285.      not already exist.  The new member will be at OFFSET (in bytes)
  286.      from the beginning of an instance of this structure, and will
  287.      have the specified NAME, TYPE, and DIMLIST.  Use OFFSET -1 to
  288.      have add_member compute the next available offset in the structure.
  289.      The TYPE can be either a structure definition, or a string naming
  290.      a previously defined data type in FILE.  The optional DIMLIST is
  291.      as for the "array" function.
  292.      The STRUCT_NAME built from a series of add_member calls cannot be
  293.      used until it is installed with install_struct.
  294.      This function should be used very sparingly, mostly in code which
  295.      is building the structure of a foreign-format binary file.
  296.    SEE ALSO: add_variable, install_struct, struct_align
  297.  */
  298.  
  299.                                                               add_next_file
  300. /* DOCUMENT failure= add_next_file(file, filename, create_flag)
  301.      adds the next file to the FILE, which must contain history records.
  302.      If FILENAME is non-nil, the new file will be called that, otherwise
  303.      the next sequential filename is used.  If CREATE_FLAG is present
  304.      and non-zero, the new file will be created if it does not already
  305.      exist.  If omitted or nil, CREATE_FLAG defaults to 1 if the file has
  306.      write permission and 0 if it does not.
  307.      Returns 0 on success.
  308.    SEE ALSO: openb, updateb, createb, add_record
  309.  */
  310.  
  311.                                                                  add_record
  312. /* DOCUMENT add_record, file, time, ncyc
  313.          or add_record, file, time, ncyc, address
  314.          or add_record, file
  315.      adds a new record to FILE corresponding to the specified TIME and
  316.      NCYC (respectively a double and a long).  Either or both TIME
  317.      and NCYC may be nil or omitted, but the existence of TIME and
  318.      NCYC must be the same for every record added to one FILE.
  319.      If present, ADDRESS specifies the disk address of the new record,
  320.      which is assumed to be in the current file.  Without ADDRESS, or
  321.      if ADDRESS<0, the next available address is used; this may create
  322.      a new file in the family (see the set_filesize function).
  323.      The add_record function leaves the new record current
  324.      for subsequent save commands to actually write the data.
  325.  
  326.      The TIME, NCYC, and ADDRESS arguments may be equal length vectors
  327.      to add several records at once; in this case, the first of the
  328.      newly added records is the current one.  If all three of TIME,
  329.      NCYC, and ADDRESS are nil or omitted, no new records are added,
  330.      but the file becomes a record file if it was not already, and in
  331.      any case, no record will be the current record after such an
  332.      add_record call.
  333.  
  334.      After the first add_record call (even if no records were added),
  335.      subsequent add_variable commands will create record variables.
  336.  
  337.                                                    FROM add_record TO anyof
  338.  
  339.      After the first record has been added, subsequent save commands
  340.      will create any new variables as record variables.
  341.      After a second record has been added using add_record, neither
  342.      save commands nor add_variable commands may be used to introduce
  343.      any new record variables.
  344.    SEE ALSO: save, createb, updateb, openb, set_filesize, set_blocksize
  345.              add_variable
  346.  */
  347.  
  348.                                                                add_variable
  349. /* DOCUMENT add_variable, file, address, name, type, dimlist
  350.      adds a variable NAME to FILE at the specified ADDRESS, with the
  351.      specified TYPE and dimensions given by DIMLIST.  The DIMLIST may
  352.      be zero or more arguments, as for the "array" function.  If the
  353.      ADDRESS is <0, the next available address is used. Note that,
  354.      unlike the save command, add_variable does not actually write any
  355.      data -- it merely changes Yorick's description of the contents of
  356.      FILE.
  357.      After the first add_record call, add_variable adds a variable to
  358.      the record instead of a non-record variable.  See add_record.
  359.    SEE ALSO: save, openb, createb, updateb, add_record,
  360.              add_member, install_struct, data_align
  361.  */
  362.  
  363.                                                                       allof
  364. /* DOCUMENT allof(x)
  365.             anyof(x)
  366.             nallof(x)
  367.             noneof(x)
  368.      Respectively:
  369.       returns 1 if every element of the array x is non-zero, else 0.
  370.       returns 1 if at least one element of the array x is non-zero, else 0.
  371.       returns 1 if at least one element of the array x is zero, else 0.
  372.       returns 1 if every element of the array x is zero, else 0.
  373.   SEE ALSO: allof, anyof, noneof, nallof, where, where2
  374.  */
  375.  
  376.                                                            alpha_primitives
  377. /* DOCUMENT alpha_primitives, file
  378.      sets FILE primitive data types to be native to DEC alpha workstations.
  379.  */
  380.  
  381.                                                               am_subroutine
  382. /* DOCUMENT am_subroutine()
  383.      returns 1 if the current Yorick function was invoked as a subroutine,
  384.      else 0.  If am_subroutine() returns true, the result of the current
  385.      function will not be used, and need not be computed (the function
  386.      has been called for its side effects only).
  387.  */
  388.  
  389.                                                                       anyof
  390.     /* SEE allof     */
  391.  
  392.                                                    FROM area TO at_pdb_open
  393.  
  394.                                                                        area
  395. /* DOCUMENT area(y, x)
  396.      returns the zonal areas of the 2-D mesh (X, Y).  If Y and X are
  397.      imax-by-jmax, the result is (imax-1)-by-(jmax-1).  The area is
  398.      positive when, say, X increases with i and Y increases with j.
  399.      For example, area([[0,0],[1,1]],[[0,1],[0,1]]) is +1.
  400.    SEE ALSO: volume
  401.  */
  402.  
  403.                                                                       array
  404. /* DOCUMENT array(value, dimension_list)
  405.          or array(type, dimension_list)
  406.      returns an object of the same type as VALUE, consisting of copies
  407.      of VALUE, with the given DIMENSION_LIST appended to the dimensions
  408.      of VALUE.  Hence, array(1.5, 3, 1) is the same as [[1.5, 1.5, 1.5]].
  409.      In the second form, the VALUE is taken as scalar zero of the TYPE.
  410.      Hence, array(short, 2, 3) is the same as [[0s,0s],[0s,0s],[0s,0s]].
  411.      A DIMENSION_LIST is a list of arguments, each of which may be
  412.      any of the following:
  413.         (1) A positive scalar integer expression,
  414.     (2) An index range with no step field (e.g.-  1:10), or
  415.     (3) A vector of integers [number of dims, length1, length2, ...]
  416.         (that is, the format returned by the dimsof function).
  417.   SEE ALSO: reshape, is_array, dimsof, numberof, grow, span, use_origins,
  418.             _lst
  419.  */
  420.  
  421.                                                                        asin
  422. /* DOCUMENT asin(x)
  423.      returns the inverse sine of its argument, range [-pi/2, pi/2].
  424.   SEE ALSO: sin, cos, tan, asin, acos, atan
  425.  */
  426.  
  427.                                                                       asinh
  428. /* DOCUMENT asinh(x)
  429.             acosh(x)
  430.             atanh(x)
  431.      returns the inverse hyperbolic sine, cosine, or tangent of
  432.      its argument.  The range of acosh is >=0.0.
  433.   SEE ALSO: sinh, cosh, tanh, sech, csch
  434.  */
  435.  
  436.                                                                at_pdb_close
  437.     /* SEE at_pdb_open     */
  438.  
  439.                                                                 at_pdb_open
  440. /* DOCUMENT at_pdb_open
  441.             at_pdb_close
  442.      bits for optional behavior when a PDB file is opened or closed:
  443.  
  444.      at_pdb_open:
  445.      000  Major-Order:  value specified in file is correct
  446.      001  Major-Order:102 always 
  447.      002  Major-Order:  opposite from what file says
  448.      003  Major-Order:101 always
  449.  
  450.                                                   FROM at_pdb_open TO batch
  451.  
  452.  
  453.      004  Strip Basis @... suffices from variable names (when possible)
  454.           Danger!  If you do this and open a file for update, the variable
  455.       names will be stripped when you close the file!
  456.      010  Use Basis @history convention on input
  457.  
  458.      The 001 and 002 bits may be overridden by the open102 keyword.
  459.      The default value of at_pdb_open is 010.
  460.  
  461.      at_pdb_close (the value at the time the file is opened or created
  462.                    is remembered):
  463.      001  Write Major-Order 102 PDB file
  464.      002  Write PDB style history data
  465.         The following are no-ops unless bit 002 is set:
  466.      004  Use Basis @history convention on output
  467.      010  Do NOT pack all history record variables into
  468.           a single structure instance.
  469.  
  470.      The 001 bit may be overridden by the close102 keyword or if
  471.      close102_default is non-zero.
  472.      The default value of at_pdb_close is 007.
  473.  
  474.    SEE ALSO: close102_default
  475.  */
  476.  
  477.                                                                        atan
  478. /* DOCUMENT atan(x)
  479.          or atan(y, x)
  480.      returns the inverse tangent of its argument, range [-pi/2, pi/2].
  481.      In the two argument form, returns the angle from (1, 0) to (x, y),
  482.      in the range (-pi, pi], with atan(1, 0)==pi/2.  (If x>=0, this is
  483.      the same as atan(y/x).)
  484.   SEE ALSO: sin, cos, tan, asin, acos, atan
  485.  */
  486.  
  487.                                                                         avg
  488. /* DOCUMENT avg(x)
  489.      returns the scalar average of all elements of its array argument.
  490.   SEE ALSO: sum, min, max
  491.  */
  492.  
  493.                                                                      backup
  494.     /* SEE bookmark     */
  495.  
  496.                                                                       batch
  497. /* DOCUMENT batch, 1
  498.             batch, 0
  499.         batch()
  500.      turns on, turns off, or tests for batch mode, respectively.
  501.      If yorick is started with the command line:
  502.         yorick -batch batch_include.i ...
  503.      then batch mode is turned on, the usual custom.i startup file is
  504.      skipped, and the file batch_include.i is parsed and executed.  The
  505.      -batch and batch_include.i command line arguments are removed from
  506.      the list returned by get_argv().  These must be the first two
  507.  
  508.                                                         FROM batch TO catch
  509.  
  510.      arguments on the command line.
  511.  
  512.      In batch mode, any error will terminate Yorick (as by the quit
  513.      function) rather than entering debug mode.
  514.  
  515.    SEE ALSO: process_argv, get_argv, set_idler
  516.  */
  517.  
  518.                                                                    bookmark
  519. /* DOCUMENT backup, f
  520.          or bmark= bookmark(f)
  521.             ...
  522.             backup, f, bmark
  523.      back up the text stream F, so that the next call to the read
  524.      function returns the same line as the previous call to read
  525.      (note that you can only back up one line).  If the optional
  526.      second argument BMARK is supplied, restores the state of the
  527.      file F to its state at the time the bookmark function was
  528.      called.
  529.      After a matching failure in read, use the single argument form
  530.      of backup to reread the line containing the matching failure.
  531.    SEE ALSO: read, rdline, open, close
  532.  */
  533.  
  534.                                                                        call
  535. /* DOCUMENT call, subroutine(arg1, arg2, arg3, arg4, arg5
  536.                              arg6, arg7, arg8);
  537.      allows a SUBROUTINE to be called with a very long argument list
  538.      as an alternative to:
  539.           subroutine, arg1, arg2, arg3, arg4, arg5,
  540.             arg6, arg7, arg8;
  541.      Note that the statement
  542.           subroutine(arg1, arg2, arg3, arg4, arg5,
  543.                      arg6, arg7, arg8);
  544.      will print the return value of subroutine, even if it is nil.
  545.      If invoked as a function, call simply returns its argument.
  546.  */
  547.  
  548.                                                                       catch
  549. /* DOCUMENT catch(category)
  550.      Catch errors of the specified category.  Category may be -1 to
  551.      catch all errors, or a bitwise or of the following bits:
  552.  
  553.         0x01 math errors (SIGFPE, math library)
  554.     0x02 I/O errors
  555.     0x04 keyboard interrupts (e.g.- control C interrupt)
  556.     0x08 other compiled errors (YError)
  557.     0x10 interpreted errors (error)
  558.  
  559.      Use catch by placing it in a function before the section of code
  560.      in which you are trying to catch errors.  When catch is called,
  561.      it always returns 0, but it records the virtual machine program
  562.      counter where it was called, and longjumps there if an error is
  563.      detected.  The most recent matching call to catch will catch the
  564.      error.  Returning from the function in which catch was called
  565.  
  566.                                                          FROM catch TO ceil
  567.  
  568.      pops that call off the list of catches the interpreter checks.
  569.  
  570.      To use catch, place the call near the top of a function:
  571.  
  572.         if (catch(category)) {
  573.       ...<code to execute if error is caught>...
  574.     }
  575.         ...<code "protected" by the catch>...
  576.  
  577.      If an error with the specified category occurs in the "protected"
  578.      code, the program jumps back to the point of the catch and acts
  579.      as if the catch function had returned 1 (remember that when catch
  580.      is actually called it always returns 0).
  581.  
  582.      In order to lessen the chances of infinite loops, the catch is
  583.      popped off the active list if it is actually used, so that a
  584.      second error will *not* be caught.  Often, this is only desirable
  585.      for the error handling code itself -- if you want to re-execute
  586.      the "protected" code, do this, and take care of the possibility
  587.      of infinite loops in your interpreted code:
  588.  
  589.         while (catch(category)) {
  590.       ...<code to execute if error is caught>...
  591.     }
  592.         ...<code "protected" by the catch>...
  593.  
  594.      After an error has been caught, the associated error message
  595.      (what would have been printed had it not been caught) is left
  596.      in the variable catch_message.
  597.  
  598.    SEE ALSO: error
  599.  */
  600.  
  601.                                                                          cd
  602. /* DOCUMENT cd, directory_name
  603.          or cd(directory_name)
  604.      change current working directory to DIRECTORY_NAME, returning
  605.      the expanded path name (i.e.- with leading environment variables,
  606.      ., .., or ~ replaced by the actual pathname).  If called as a
  607.      function, returns nil to indicate failure, otherwise failure
  608.      causes a Yorick error.
  609.    SEE ALSO: get_cwd, get_home, get_env, get_argv
  610.  */
  611.  
  612.                                                                        ceil
  613. /* DOCUMENT ceil(x)
  614.      returns the smallest integer not less than x (no-op on integers).
  615.   SEE ALSO: floor
  616.  */
  617.  
  618.                                                      FROM close TO close102
  619.  
  620.                                                                       close
  621. /* DOCUMENT close, f
  622.      closes the I/O stream F (returned earlier by the open function).
  623.      If F is a simple variable reference (as opposed to an expression),
  624.      the close function will set F to nil.  If F is the only reference
  625.      to the I/O stream, then "close, f" is equivalent to "f= []".
  626.      Otherwise, "close, f" will close the file (so that subsequent
  627.      I/O operations will fail) and print a warning message about the
  628.      outstanding ("stale") references.
  629.   SEE ALSO: open, read, write, rdline, bookmark, backup, save, restore,
  630.             rename, remove
  631.  */
  632.  
  633.                                                                    close102
  634. /* DOCUMENT close102  is a keyword for createb or updateb,
  635.             open102   is a keyword for openb or updateb
  636.         close102_default   is a global variable (initially 0)
  637.           ***Do not use close102_default -- use at_pdb_close
  638.              -- this is for backward compatibility only***
  639.  
  640.         close102=1  means to close the PDB file "Major-Order:102"
  641.         close102=0  means close it "Major-Order:101"
  642.            if not specified, uses 1 if close102_default non-zero,
  643.            otherwise the value specified in at_pdb_close
  644.  
  645.         open102=1   means to ignore what the PDB file says internally,
  646.                     and open it as if it were "Major-Order:102"
  647.         open102=0   (the default) means to assume the PDB file is
  648.                         correctly writen
  649.         open102=2   means to assume that the file is incorrectly
  650.                     written, whichever way it is marked
  651.         open102=3   means to ignore what the PDB file says internally,
  652.                     and open it as if it were "Major-Order:101"
  653.  
  654.      The PDB file format comes in two styles, "Major-Order:101", and
  655.      "Major-Order:102".  Yorick interprets these correctly by default,
  656.      but other codes may ignore them, or write them incorrectly.
  657.  
  658.      Unlike Yorick, not all codes are able to correctly read both
  659.      styles.  If you are writing a file which needs to be read by
  660.      a "102 style" code, create it with the close102=1 keyword.
  661.  
  662.      If you notice that a file you though was a history file isn't, or
  663.      that the dimensions of multi-dimensional variables are transposed
  664.      from the order you expected, the code which wrote the file probably
  665.      blew it.  Try openb("filename", open102=2).  The choices 1 and 3
  666.      are for cases in which you know the writing code was supposed to
  667.      write the file one way or the other, and you don't want to be
  668.      bothered.
  669.  
  670.      The open102 and close102 keywords, if present, override the
  671.      defaults in the variables at_pdb_open and at_pdb_close.
  672.  
  673.    SEE ALSO: at_pdb_open, at_pdb_close
  674.  */
  675.  
  676.                                    FROM close102_default TO cray_primitives
  677.  
  678.                                                            close102_default
  679.     /* SEE close102     */
  680.  
  681.                                                                     collect
  682. /* DOCUMENT result= collect(f, name_string)
  683.      scans through all records of the history file F accumulating the
  684.      variable NAME_STRING into a single array with one additional
  685.      index varying from 1 to the number of records.
  686.  
  687.      NAME_STRING can be either a simple variable name, or a name
  688.      followed by up to four simple indices which are either nil, an
  689.      integer, or an index range with constant limits.  (Note that
  690.      0 or negative indices count from the end of a dimension.)
  691.  
  692.      Examples:
  693.         collect(f, "xle")        -- collects the variable f.xle
  694.     collect(f, "tr(2,2:)")   -- collects f.tr(2,2:)
  695.     collect(f, "akap(2,-1:0,)") -- collects f.akap(2,-1:0,)
  696.                  (i.e.- akap in the last two values of its
  697.                     second index)
  698.  
  699.    SEE ALSO: get_times
  700.  */
  701.  
  702.                                                                        conj
  703. /* DOCUMENT conj(x)
  704.      returns the complex conjugate of its argument.
  705.  */
  706.  
  707.                                                                   copyright
  708. /* DOCUMENT copyright, (no) warranty
  709.  
  710.      Copyright (c) 1995.  The Regents of the University of California.
  711.                    All rights reserved.
  712.  
  713.      Yorick is provided "as is" without any warranty, either expressed or
  714.      implied.  For a complete statement, type:
  715.  
  716.         legal
  717.  
  718.      at the Yorick prompt.
  719.  
  720.    SEE ALSO: legal
  721.  */
  722.  
  723.                                                                         cos
  724.     /* SEE sin     */
  725.  
  726.                                                                        cosh
  727.     /* SEE sinh     */
  728.  
  729.                                                             cray_primitives
  730. /* DOCUMENT cray_primitives, file
  731.      sets FILE primitive data types to be native to Cray 1, XMP, and YMP.
  732.  */
  733.  
  734.                                                        FROM create TO dbdis
  735.  
  736.                                                                      create
  737. /* DOCUMENT f= create(filename)
  738.      is a synonym for       f= open(filename, "w")
  739.      Creates a new text file FILENAME, destroying any existing file of
  740.      that name.  Use the write function to write into the file F.
  741.    SEE ALSO: write, close, open
  742.  */
  743.  
  744.                                                                     createb
  745. /* DOCUMENT file= createb(filename)
  746.          or file= createb(filename, primitives)
  747.      creates FILENAME as a PDB file in "w+b" mode, destroying any
  748.      existing file by that name.  If the PRIMITIVES argument is
  749.      supplied, it must be the name of a procedure that sets the
  750.      primitive data types for the file.  The default is to create
  751.      a file with the native primitive types of the machine on which
  752.      Yorick is running.  The following PRIMITIVES functions are
  753.      predefined:
  754.         sun_primitives    -- appropriate for Sun, HP, IBM, and
  755.                          most other workstations
  756.         sun3_primitives   -- appropriate for old Sun-2 or Sun-3
  757.         dec_primitives    -- appropriate for DEC (MIPS) workstations
  758.         alpha_primitives  -- appropriate for DEC alpha workstations
  759.         cray_primitives   -- appropriate for Cray 1, XMP, and YMP
  760.     mac_primitives    -- appropriate for MacIntosh
  761.     macl_primitives   -- appropriate for MacIntosh, 12-byte double
  762.     pc_primitives     -- appropriate for IBM PC
  763.         vax_primitives    -- appropriate for VAXen only (H doubles)
  764.         vaxg_primitives   -- appropriate for VAXen only (G doubles)
  765.         xdr_primitives    -- appropriate for XDR files
  766.   SEE ALSO: openb, updateb, cd
  767.             save, add_record, set_filesize, set_blocksize
  768.         close102, close102_default, at_pdb_open, at_pdb_close
  769.  */
  770.  
  771.                                                                  data_align
  772. /* DOCUMENT data_align, file, alignment
  773.      in binary file FILE, align new variables to begin at a byte address
  774.      which is a multiple of ALIGNMENT.  (This affects placement of data
  775.      declared using save and add_variable.  For add_variable, data_align
  776.      has an effect only if the address is not specified.)  If ALIGNMENT
  777.      is <=0, new variables will be aligned as they would be if they were
  778.      data structure members.  The default value is 0.
  779.    SEE ALSO: save, add_variable
  780.  */
  781.  
  782.                                                                      dbauto
  783.     /* SEE dbexit     */
  784.  
  785.                                                                      dbcont
  786.     /* SEE dbexit     */
  787.  
  788.                                                                       dbdis
  789.     /* SEE dbexit     */
  790.  
  791.                                                       FROM dbexit TO dbexit
  792.  
  793.                                                                      dbexit
  794. /* DOCUMENT Debug mode.
  795.  
  796.    Yorick errors fall into two general categories: Syntax errors discovered
  797.    during parsing, and runtime errors discovered when a Yorick program is
  798.    actually running.  When a runtime error occurs, Yorick offers the
  799.    choice of entering "debug mode", which you can do by typing the <RETURN>
  800.    key immediately after the error occurs.  Typing a non-blank line exits
  801.    debug mode automatically by default.  In debug mode, the Yorick prompt
  802.    becomes "dbug>" instead of the usual ">".  When you see this prompt,
  803.    Yorick has halted "in the middle of" the function in which the error
  804.    occurred, and you can print, plot, modify, or save the local variables
  805.    in that function by means of ordinary Yorick commands.  Debug mode is
  806.    recursive; that is, you can debug an error which occurred during
  807.    debugging to any number of levels.
  808.  
  809.    You can exit from debug mode in several ways:
  810.  
  811.       dbexit            -- exit current debug level, discarding all
  812.                            active functions and their local variables
  813.       dbexit, 0         -- exit all debug levels
  814.       dbexit, n         -- exit (at most) N debug levels
  815.  
  816.       dbcont            -- continue execution of the current function
  817.          Continuing is useful if you have managed to repair the
  818.      problem which caused the error.  The expression in which the
  819.      error occurred will be evaluated a second time, so beware of
  820.      side effects.
  821.  
  822.       dbret, value      -- continue execution by returning VALUE (which
  823.                            may be nil or omitted) to the caller of the
  824.                function in which the error occurred.
  825.      This is useful if the function in which the error occurred is
  826.      hopelessly confounded, but you know the value it should return.
  827.  
  828.    Yorick does not allow "single stepping" directly, although you can
  829.    execute the statements in a function by copying them, then tell
  830.    Yorick to skip those statements you have executed "by hand".  There
  831.    are two functions for skipping execution:
  832.  
  833.       dbskip            -- skip the next logical line (This will be only
  834.                            a portion of a source line if several statements
  835.                are stacked on the source line.)
  836.       dbskip, n         -- skip next N (positive or negative) logical lines
  837.  
  838.       dbup              -- discard the current function, so that you are
  839.                            debugging its caller -- there is no way to go
  840.                back "down", so be careful
  841.  
  842.    There are two functions which print information (like other print
  843.    functions, if called as functions instead of subroutines, their
  844.    result is returned as a string array with one line per string):
  845.  
  846.       dbinfo            -- returns current function and source line
  847.  
  848.  
  849.                                                       FROM dbexit TO dimsof
  850.  
  851.       dbdis             -- returns disassembled virtual machine code
  852.                            for the next line (use the disassemble function
  853.                to get the entire function)
  854.      This allows you to see exactly where in a line the error occurred.
  855.  
  856.    Finally,
  857.  
  858.       dbauto            -- toggles whether debug mode will be entered
  859.                            automatically when a runtime error occurs
  860.       dbauto, 1         -- enter debug mode automatically after an error
  861.       dbauto, 0         -- type <RETURN> after error to enter debug mode
  862.  */
  863.  
  864.                                                                      dbinfo
  865.     /* SEE dbexit     */
  866.  
  867.                                                                       dbret
  868.     /* SEE dbexit     */
  869.  
  870.                                                                      dbskip
  871.     /* SEE dbexit     */
  872.  
  873.                                                                        dbup
  874.     /* SEE dbexit     */
  875.  
  876.                                                              dec_primitives
  877. /* DOCUMENT dec_primitives, file
  878.      sets FILE primitive data types to be native to DEC (MIPS) workstations.
  879.  */
  880.  
  881.                                                                    digitize
  882. /* DOCUMENT digitize(x, bins)
  883.      returns an array of longs with dimsof(X), and values i such that
  884.      BINS(i-1) <= X < BINS(i) if BINS is monotonically increasing, or
  885.      BINS(i-1) > X >= BINS(i) if BINS is monotonically decreasing.
  886.      Beyond the bounds of BINS, returns either i=1 or i=numberof(BINS)+1
  887.      as appropriate.
  888.    SEE ALSO: histogram, interp, integ, sort, where, where2
  889.  */
  890.  
  891.                                                                      dimsof
  892. /* DOCUMENT dimsof(object)
  893.          or dimsof(object1, object2, ...)
  894.      returns a vector of integers describing the dimensions of OBJECT.
  895.      The format of the vector is [number of dims, length1, length2, ...].
  896.      The orgsof function returns the origin of each dimension (normally 1).
  897.      If more than one argument is given, dimsof returns the dimension
  898.      list of the result of binary operations between all the objects,
  899.      or nil if the objects are not conformable.
  900.   SEE ALSO: typeof, structof, numberof, sizeof, orgsof
  901.  */
  902.  
  903.                                               FROM disassemble TO eq_nocopy
  904.  
  905.                                                                 disassemble
  906. /* DOCUMENT disassemble(function)
  907.          or disassemble, function
  908.      Disassembles the specified function.  If called as a function, the
  909.      result is returned as a vector of strings; if called as a subroutine,
  910.      the disassembly is printed at the terminal.  If the function is nil,
  911.      the current *main* program is disassembled -- you must include the
  912.      call to disassemble in the main program, of course, NOT on its own
  913.      line as a separate main program.
  914.  */
  915.  
  916.                                                                   dump_clog
  917. /* DOCUMENT dump_clog, file, clog_name
  918.      dumps a Contents Log of the binary file FILE into the text file
  919.      CLOG_NAME.  Any previous file named CLOG_NAME is overwritten.
  920.   SEE ALSO: openb
  921.  */
  922.  
  923.                                                                  edit_times
  924. /* DOCUMENT edit_times, file
  925.          or edit_times, file, keep_list
  926.          or edit_times, file, keep_list, new_times, new_ncycs
  927.      edits the records for FILE.  The KEEP_LIST is a 0-origin index list
  928.      of records to be kept, or nil to keep all records.  The NEW_TIMES
  929.      array is the list of new time values for the (kept) records, and
  930.      the NEW_NCYCS array is the list of new cycle number values for the
  931.      (kept) records.  Either NEW_TIMES, or NEW_NCYCS, or both, may be
  932.      nil to leave the corresponding values unchanged.  If non-nil,
  933.      NEW_TIMES and NEW_NCYCS must have the same length as KEEP_LIST,
  934.      or, if KEEP_LIST is nil, as the original number of records in
  935.      the file.  If KEEP_LIST, NEW_TIME, and NEW_NCYCS are all omitted
  936.      or nil, then edit_times removes records as necessary to ensure
  937.      that the remaining records have monotonically increasing times,
  938.      or, if no times are present, monotonically increasing ncycs.
  939.      (The latest record at any given time/ncyc is retained, and earlier
  940.      records are removed.)
  941.      In no case does edit_times change the FILE itself; only Yorick's
  942.      in-memory model of the file is altered.
  943.    SEE ALSO: get_times, get_ncycs, jt, jc
  944.  */
  945.  
  946.                                                                   eq_nocopy
  947. /* DOCUMENT eq_nocopy, y, x
  948.      is the same as
  949.             y= x
  950.      except that if x is an array, it is not copied, even if it is
  951.      not a temporary (i.e.- an expression).  Having multiple variables
  952.      reference the same data can be confusing, which is why the default
  953.      = operation copies the array.  The most important use of eq_nocopy
  954.      involves pointers or lists:
  955.             y= *py
  956.         z= _car(list)
  957.      always causes the data pointed to by py to be copied, while
  958.             eq_nocopy, y, *py
  959.         eq_nocopy, z, _car(list)
  960.  
  961.                                                 FROM eq_nocopy TO get_addrs
  962.  
  963.      does not copy the data - often more nearly what you wanted.
  964.      Note that scalar int, long, and double variables are always copied,
  965.      so you cannot count on eq_nocopy setting up an "equivalence"
  966.      between variables.
  967.  */
  968.  
  969.                                                                       error
  970. /* DOCUMENT exit, msg
  971.             error, msg
  972.      Exits the current interpreted *main* program, printing the MSG.
  973.      (MSG can be omitted to print a default.)
  974.      In the case of exit, the result is equivalent to an immediate
  975.      return from every function in the current calling chain.
  976.      In the case of error, the result is the same as if an error had
  977.      occurred in a compiled routine.
  978.    SEE ALSO: print, write, batch, catch
  979.  */
  980.  
  981.                                                                        exit
  982.     /* SEE error     */
  983.  
  984.                                                                         exp
  985. /* DOCUMENT exp(x)
  986.      returns the exponential function of its argument (inverse of log).
  987.   SEE ALSO: log, log10, sinh, cosh, tanh, sech, csch
  988.  */
  989.  
  990.                                                                       floor
  991. /* DOCUMENT floor(x)
  992.      returns the largest integer not greater than x (no-op on integers).
  993.   SEE ALSO: ceil
  994.  */
  995.  
  996.                                                                   get_addrs
  997. /* DOCUMENT addr_lists= get_addrs(file)
  998.      returns the byte addresses of the non-record and record variables
  999.      in the binary file FILE, and lists of the record addresses, file
  1000.      indices, and filenames for file families with history records.
  1001.           *addr_lists(1)   absolute addresses of non-record variables
  1002.       *addr_lists(2)   relative addresses of record variables
  1003.                        (add record address to get absolute address)
  1004.          The order of these two address lists matches the
  1005.          corresponding lists of names returned by get_vars.
  1006.       *addr_lists(3)   absolute addresses of records
  1007.       *addr_lists(4)   list of file indices corresponding to
  1008.                        addr_lists(3); indices are into addr_lists(5)
  1009.       *addr_lists(5)   list of filenames in the family
  1010.    SEE ALSO: openb, updateb, restore, jt, jc, has_records, get_vars
  1011.  */
  1012.  
  1013.                                                   FROM get_argv TO get_vars
  1014.  
  1015.                                                                    get_argv
  1016. /* DOCUMENT get_argv()
  1017.      returns string array containing the argv from the command line.
  1018.      The -batch and batch_include.i arguments are removed (not returned).
  1019.    SEE ALSO: process_argv, cd, get_cwd, get_home, get_env, batch
  1020.  */
  1021.  
  1022.                                                                     get_cwd
  1023. /* DOCUMENT get_cwd()
  1024.          or get_home()
  1025.      returns the pathname of the current working directory or of your
  1026.      home directory.
  1027.    SEE ALSO: cd, get_env, get_argv
  1028.  */
  1029.  
  1030.                                                                     get_env
  1031. /* DOCUMENT get_env(environment_variable_name)
  1032.      returns the environment variable (a string) associated with
  1033.      ENVIRONMENT_VARIABLE_NAME (calls ANSI getenv routine).
  1034.    SEE ALSO: cd, get_cwd, get_home, get_env, get_argv
  1035.  */
  1036.  
  1037.                                                                    get_home
  1038.     /* SEE get_cwd     */
  1039.  
  1040.                                                                  get_member
  1041. /* DOCUMENT get_member(f_or_s, member_name)
  1042.      returns F_OR_S member MEMBER_NAME, like F_OR_S.MEMBER_NAME syntax,
  1043.      but MEMBER_NAME can be a computed string.  The F_OR_S may be a
  1044.      binary file or a structure instance.
  1045.    SEE ALSO: openb
  1046.  */
  1047.  
  1048.                                                                   get_ncycs
  1049.     /* SEE get_times     */
  1050.  
  1051.                                                                   get_times
  1052. /* DOCUMENT times= get_times(file)
  1053.             ncycs= get_ncycs(file)
  1054.      returns the list of time or ncyc values associated with the records
  1055.      if FILE, or nil if there are none.  The time values are not guaranteed
  1056.      to be precise (but they should be good to at least 6 digits or so);
  1057.      the precise time associated with each record may be stored as a record
  1058.      variable.
  1059.    SEE ALSO: collect, openb, updateb, restore, jt, jc, edit_times
  1060.  */
  1061.  
  1062.                                                                    get_vars
  1063. /* DOCUMENT name_lists= get_vars(file)
  1064.      returns the lists of non-record and record variable names in the
  1065.      binary FILE.  The return value is an array of two pointers to
  1066.      arrays of type string; *name_lists(1) is the array of non-record
  1067.      variable names (or nil if there are none), *name_lists(2) is the
  1068.      array of record variable names.
  1069.      The get_addrs function returns corresponding lists of disk
  1070.  
  1071.                                                       FROM get_vars TO help
  1072.  
  1073.      addresses; the get_member function can be used in conjunction
  1074.      with the dimsof, structof, and typeof functions to determine
  1075.      the other properties of a variable.
  1076.    SEE ALSO: openb, updateb, restore, jt, jc, has_records, get_addrs
  1077.  */
  1078.  
  1079.                                                                        grow
  1080. /* DOCUMENT grow, x, xnext1, xnext2, ...
  1081.          or grow(x, xnext1, xnext2, ...)
  1082.      or    _(x, xnext1, xnext2, ...)
  1083.      lengthens the array X by appending XNEXT1, XNEXT2, etc. to its
  1084.      final dimension.  If X is nil, X is first redefined to the first
  1085.      non-nil XNEXT, and the remainder of the XNEXT list is processed
  1086.      normally.  Each XNEXT is considered to have the same number of
  1087.      dimensions as X, by appending unit-length dimensions if necessary.
  1088.      All but this final dimension of each XNEXT must be right-conformable
  1089.      (that is, conformable in the sense of the right hand side of an
  1090.      assignment statement) with all but the final dimension of X.
  1091.      The result has a final dimension which is the sum of the final
  1092.      dimension of X and all the final dimensions of the XNEXT.  Nil
  1093.      XNEXT are ignored.  The value of the result is obtained by
  1094.      concatenating all the XNEXT to X, after any required broadcasts.
  1095.  
  1096.      If invoked as a function, grow returns the new value of X; in
  1097.      this case, X may be an expression.  X must be a simple variable
  1098.      reference for the subroutine form of grow; otherwise there is
  1099.      nowhere to return the result.  The subroutine form is slightly
  1100.      more efficient than the function form for the common usage:
  1101.           x= grow(x, xnext1, xnext2)           is the same as
  1102.       grow, x, xnext1, xnext2              the preferred form
  1103.  
  1104.      The _ function is a synonym for grow, for people who want this
  1105.      operator to look like punctuation in their source code, on analogy
  1106.      with the array building operator [a, b, c, ...].
  1107.  
  1108.      The _cat function is sometimes more appropriate than grow.
  1109.  
  1110.    SEE ALSO: _cat, array, compare with the array building operator [...]
  1111.  */
  1112.  
  1113.                                                                 has_records
  1114. /* DOCUMENT has_records(file)
  1115.      returns 1 if FILE has history records, 0 if it does not.
  1116.  */
  1117.  
  1118.                                                                        help
  1119. /* DOCUMENT help, topic
  1120.          or help
  1121.      Prints DOCUMENT comment from include file in which the variable
  1122.      TOPIC was defined, followed by the line number and filename.
  1123.      By opening the file with a text editor, you may be able to find
  1124.      out more, especially if no DOCUMENT comment was found.
  1125.      Examples:
  1126.        help, set_path
  1127.      prints the documentation for the set_path function.
  1128.  
  1129.                                                      FROM help TO histogram
  1130.  
  1131.        help
  1132.      prints the DOCUMENT comment you are reading.
  1133.  
  1134.      This copy of Yorick was launched from the directory:
  1135.      **** Y_LAUNCH (computed at runtime) ****
  1136.      Yorick's "site directory" at this site is:
  1137.      **** Y_SITE (computed at runtime) ****
  1138.      You can find out a great deal more about Yorick by browsing
  1139.      through these directories.  Begin with the site directory,
  1140.      and pay careful attention to the subdirectories doc/ (which
  1141.      contains documentation relating to Yorick), and include/ and
  1142.      contrib/ (which contain many examples of Yorick programs).
  1143.      Look for files called README (or something similar) in any
  1144.      of these directories -- they are intended to assist browsers.
  1145.      The site directory itself contains std.i and graph.i, which
  1146.      are worth reading.
  1147.  
  1148.      Type:
  1149.        help, dbexit
  1150.      for help on debug mode.  If your prompt is "dbug>" instead of
  1151.      ">", dbexit will return you to normal mode.
  1152.  
  1153.    SEE ALSO: info, print, copyright, warranty, legal
  1154.  */
  1155.  
  1156.                                                                   histogram
  1157. /* DOCUMENT histogram(list)
  1158.          or histogram(list, weight)
  1159.      returns an array hist which counts the number of occurrences of each
  1160.      element of the input index LIST, which must consist of positive
  1161.      integers (1-origin index values into the result array):
  1162.           histogram(list)(i) = number of occurrences of i in LIST
  1163.  
  1164.      A second argument WEIGHT must have the same shape as LIST; the result
  1165.      will be the sum of WEIGHT:
  1166.           histogram(list)(i) = sum of all WEIGHT(j) where LIST(j)==i
  1167.  
  1168.      The result of the single argument call will be of type long; the
  1169.      result of the two argument call will be of type double (WEIGHT is
  1170.      promoted to that type).  The input argument(s) may have any number
  1171.      of dimensions; the result is always 1-D.
  1172.  
  1173.    KEYWORD: top=max_list_value
  1174.      By default, the length of the result is max(LIST).  You may
  1175.      specify that the result have a larger length by means of the TOP
  1176.      keyword.  (Elements beyond max(LIST) will be 0, of course.)
  1177.  
  1178.    SEE ALSO: digitize, sort
  1179.  */
  1180.  
  1181.                                                     FROM include TO include
  1182.  
  1183.                                                                     include
  1184. /* DOCUMENT #include "yorick_source.i"
  1185.             require, filename
  1186.             include, filename
  1187.          or include, filename, now
  1188.  
  1189.      #include is a parser directive, not a Yorick statement.  Use it
  1190.      to read Yorick source code which you have saved in a file; the
  1191.      file yorick_source.i will be read one line at a time, exactly as
  1192.      if you had typed those lines at the keyboard.  The following
  1193.      directories are searched (in this order) to find yorick_source.i:
  1194.  
  1195.         .               (current working directory)
  1196.     ~/Yorick        (your personal directory of Yorick functions)
  1197.     Y_SITE/include  (Yorick distribution library)
  1198.     Y_SITE/contrib  (contributed source at your site)
  1199.  
  1200.      To find out what is available in the Yorick/include directory,
  1201.      type:
  1202.          library
  1203.      You can also type
  1204.          Y_SITE
  1205.      to find the name of the site directory at your site, go to the
  1206.      include or contrib subdirectory, and browse through the *.i files.
  1207.      This is a good way to learn how to write a Yorick program.  Be
  1208.      alert for files like README as well.
  1209.  
  1210.      The require function checks to see whether FILENAME has already
  1211.      been included (actually whether any file with the same final
  1212.      path component has been included).  If so, require is a no-op,
  1213.      otherwise, the action is the same as the include function with
  1214.      NOW == 1.
  1215.  
  1216.      The include function causes Yorick to parse and execute FILENAME
  1217.      immediately.  The effect is similar to the #include parser
  1218.      directive, except the finding, parsing, and execution of FILENAME
  1219.      occurs at runtime.  If the NOW argument is given and positive,
  1220.      the include occurs immediately, if nil or 0, it occurs just before
  1221.      the next line would have been parsed.  If NOW is negative, the
  1222.      include file is pushed onto a stack, and will be popped off and
  1223.      parsed when all pending input has been processed.
  1224.  
  1225.      Unless you are writing a startup file, or have some truly bizarre
  1226.      technical reason for using the include function, use #include
  1227.      instead.  The functional form of include may involve recursive
  1228.      parsing, which you will not be able to understand without deep
  1229.      study.  Stick with #include.
  1230.  
  1231.    SEE ALSO: set_path, Y_SITE
  1232.  */
  1233.  
  1234.                                                        FROM indgen TO integ
  1235.  
  1236.                                                                      indgen
  1237. /* DOCUMENT indgen(n)
  1238.          or indgen(start:stop)
  1239.          or indgen(start:stop:step)
  1240.      returns "index generator" list -- an array of longs running from
  1241.      1 to N, inclusive.  In the second and third forms, the index
  1242.      values specified by the index range are returned.
  1243.    SEE ALSO: span, spanl, array
  1244.  */
  1245.  
  1246.                                                                        info
  1247. /* DOCUMENT info, expr
  1248.      prints the data type and array dimensions of EXPR.
  1249.    SEE ALSO: help, print
  1250.  */
  1251.  
  1252.                                                              install_struct
  1253. /* DOCUMENT install_struct, file, struct_name
  1254.          or install_struct, file, struct_name, size, align, order
  1255.          or install_struct, file, struct_name, size, align, order, layout
  1256.      installs the data type named STRUCT_NAME in the binary FILE.  In
  1257.      the two argument form, STRUCT_NAME must have been built by one or
  1258.      more calls to the add_member function.  In the 5 and 6 argument calls,
  1259.      STRUCT_NAME is a primitive data type -- an integer type for the 5
  1260.      argument call, and a floating point type for the 6 argument call.
  1261.      The 5 argument form may also be used to declare opaque data types.
  1262.      SIZE is the size of an instance in bytes, ALIGN is its alignment
  1263.      boundary (also in bytes), and ORDER is the byte order.  ORDER is
  1264.      1 for most significant byte first, -1 for least significant byte
  1265.      first, and 0 for opaque (unconverted) data.  Other ORDER values
  1266.      represent more complex byte permutations (2 is the byte order for
  1267.      VAX floating point numbers).  If ORDER equals SIZE, then the data
  1268.      type is not only opaque, but also must be read sequentially.
  1269.      LAYOUT is an array of 7 long values parameterizing the floating
  1270.      point format, [sign_address, exponent_address, exponent_size,
  1271.      mantissa_address, mantissa_size, mantissa_normalized, exponent_bias]
  1272.      (the addresses and sizes are in bits, reduced to MSB first order).
  1273.      Use, e.g., nameof(float) for STRUCT_NAME to redefine the meaning
  1274.      of the float data type for FILE.
  1275.    SEE ALSO: add_variable, add_member
  1276.  */
  1277.  
  1278.                                                                       integ
  1279. /* DOCUMENT integ(y, x, xp)
  1280.          or integ(y, x, xp, which)
  1281.      See the interp function for an explanation of the meanings of the
  1282.      arguments.  The integ function returns ypi which is the integral
  1283.      of the piecewise linear curve (X(i), Y(i)) (i=1, ..., numberof(X))
  1284.      from X(1) to XP.  The curve (X, Y) is regarded as constant outside
  1285.      the bounds of X.  Note that X must be monotonically increasing or
  1286.    SEE ALSO: interp, digitize, span
  1287.  */
  1288.  
  1289.                                                    FROM interp TO is_struct
  1290.  
  1291.                                                                      interp
  1292. /* DOCUMENT interp(y, x, xp)
  1293.          or interp(y, x, xp, which)
  1294.      returns yp such that (XP, yp) lies on the piecewise linear curve
  1295.      (X(i), Y(i)) (i=1, ..., numberof(X)).  Points beyond X(1) are set
  1296.      to Y(1); points beyond X(0) are set to Y(0).  The array X must be
  1297.      one dimensional, have numberof(X)>=2, and be either monotonically
  1298.      increasing or monotonically decreasing.  The array Y may have more
  1299.      than one dimension, but dimension WHICH must be the same length as
  1300.      X.  WHICH defaults to 1, the first dimension of Y.  WHICH may be
  1301.      non-positive to count dimensions from the end of Y; a WHICH of 0
  1302.      means the final dimension of Y.  The result yp has dimsof(XP)
  1303.      in place of the WHICH dimension of Y (if XP is scalar, the WHICH
  1304.      dimension is not present).  (The dimensions of the result are the
  1305.      same as if an index list with dimsof(XP) were placed in slot
  1306.      WHICH of Y.)
  1307.    SEE ALSO: integ, digitize, span
  1308.  */
  1309.  
  1310.                                                                    is_array
  1311. /* DOCUMENT is_array(object)
  1312.      returns 1 if OBJECT is an array data type (as opposed to a function,
  1313.      structure definition, index range, I/O stream, etc.), else 0.
  1314.      An array OBJECT can be written to or read from a binary file;
  1315.      non-array Yorick data types cannot.
  1316.   SEE ALSO: is_func, is_void, is_range, is_struct, is_stream
  1317.  */
  1318.  
  1319.                                                                     is_func
  1320. /* DOCUMENT is_func(object)
  1321.      returns 1 if OBJECT is a Yorick interpreted function, 2 if OBJECT
  1322.      is a built-in (that is, compiled) function, else 0.
  1323.   SEE ALSO: is_array, is_void, is_range, is_struct, is_stream
  1324.  */
  1325.  
  1326.                                                                    is_range
  1327. /* DOCUMENT is_range(object)
  1328.      returns 1 if OBJECT is an index range (e.g.-  3:5 or 11:31:2),
  1329.      else 0.
  1330.   SEE ALSO: is_array, is_func, is_void, is_struct, is_stream
  1331.  */
  1332.  
  1333.                                                                   is_stream
  1334. /* DOCUMENT is_stream(object)
  1335.      returns 1 if OBJECT is an I/O stream (usually a file), else 0.
  1336.   SEE ALSO: is_array, is_func, is_void, is_range, is_struct
  1337.  */
  1338.  
  1339.                                                                   is_struct
  1340. /* DOCUMENT is_struct(object)
  1341.      returns 1 if OBJECT is the definition of a Yorick struct, else 0.
  1342.      Thus, is_struct(double) returns 1, but is_struct(1.0) returns 0.
  1343.   SEE ALSO: is_array, is_func, is_void, is_range, is_stream
  1344.  */
  1345.  
  1346.                                                          FROM is_void TO jt
  1347.  
  1348.                                                                     is_void
  1349. /* DOCUMENT is_void(object)
  1350.      returns 1 if OBJECT is nil (the one instance of the void data type),
  1351.      else 0.
  1352.   SEE ALSO: is_array, is_func, is_range, is_struct, is_stream
  1353.  */
  1354.  
  1355.                                                                          jc
  1356. /* DOCUMENT jc, file, ncyc
  1357.      jump to the record of FILE nearest the specified NCYC.
  1358.    SEE ALSO: jt, _jc, edit_times, show, jr
  1359.  */
  1360.  
  1361.                                                                          jr
  1362. /* DOCUMENT jr, file, i
  1363.          or _jr(file, i)
  1364.      Jump to a particular record number I (from 1 to n_records) in a
  1365.      binary file FILE.  The function returns 1 if such a record exists,
  1366.      0 if there is no such record.  In the latter case, no action is
  1367.      taken; the program halts with an error only if jr was invoked
  1368.      as a subroutine.  Record numbering wraps like array indices; use
  1369.      jr, file, 0  to jump to the last record, -1 to next to last, etc.
  1370.    SEE ALSO: jt, jc, edit_times, show
  1371.  */
  1372.  
  1373.                                                                          jt
  1374. /* DOCUMENT jt, time
  1375.          or jt, file, time
  1376.          or jt, file
  1377.          or jt, file, -
  1378.      jump to the record nearest the specified TIME.  If no FILE is
  1379.      specified, the current record of all open binary files containing
  1380.      records is shifted.
  1381.      If both FILE and TIME are specified and jt is called as a function,
  1382.      it returns the actual time of the new current record.
  1383.  
  1384.    N.B.: "jt, file" and "jt, file, -" are obsolete.  Use the jr function to
  1385.      step through a file one record at a time.
  1386.  
  1387.      If only the FILE is specified, increment the current record of that
  1388.      FILE by one.  If the TIME argument is - (the pseudo-index range
  1389.      function), decrement the current record of FILE by one.
  1390.      If the current record is the last, "jt, file" unsets the current record
  1391.      so that record variables will be inaccessible until another jt or jc.
  1392.      The same thing happens with "jt, file, -" if the current record was the
  1393.      first.
  1394.      If only FILE is specified, jt returns 1 if there is a new current
  1395.      record, 0 if the call resulted in no current record.  Thus "jt(file)"
  1396.      and "jt(file,-)" may be used as the condition in a while loop to step
  1397.      through every record in a file:
  1398.         file= openb("example.pdb");
  1399.         do {
  1400.       restore, file, interesting_record_variables;
  1401.  
  1402.                                                              FROM jt TO max
  1403.  
  1404.       ...calculations...
  1405.     } while (jt(file));
  1406.  
  1407.    SEE ALSO: jc, _jt, edit_times, show, jr
  1408.  */
  1409.  
  1410.                                                                       legal
  1411. /* DOCUMENT legal
  1412.      Prints the legal details of Yorick's copyright, licensing,
  1413.      and lack of warranty.
  1414.    SEE ALSO: copyright, warranty
  1415.  */
  1416.  
  1417.                                                                     library
  1418. /* DOCUMENT library
  1419.      print the Y_SITE/include/README file at the terminal.
  1420.  */
  1421.  
  1422.                                                                         log
  1423. /* DOCUMENT log(x)
  1424.      returns the natural logarithm of its argument (inverse of exp).
  1425.   SEE ALSO: log10, exp, asinh, acosh, atanh
  1426.  */
  1427.  
  1428.                                                                       log10
  1429. /* DOCUMENT log10(x)
  1430.      returns the base 10 logarithm of its argument (inverse of 10^x).
  1431.   SEE ALSO: log, exp, asinh, acosh, atanh
  1432.  */
  1433.  
  1434.                                                              mac_primitives
  1435. /* DOCUMENT mac_primitives, file
  1436.      sets FILE primitive data types to be native to MacIntosh, 8 byte double.
  1437.  */
  1438.  
  1439.                                                             macl_primitives
  1440. /* DOCUMENT macl_primitives, file
  1441.      sets FILE primitive data types to be native to MacIntosh, long double.
  1442.  */
  1443.  
  1444.                                                                         max
  1445. /* DOCUMENT max(x)
  1446.          or max(x, y, z, ...)
  1447.      returns the scalar maximum value of its array argument, or, if
  1448.      more than one argument is supplied, returns an array of the
  1449.      maximum value for each array element among the several arguments.
  1450.      In the multi-argument case, the arguments must be conformable.
  1451.   SEE ALSO: min, sum, avg
  1452.  */
  1453.  
  1454.                                                        FROM median TO merge
  1455.  
  1456.                                                                      median
  1457. /* DOCUMENT median(x)
  1458.          or median(x, which)
  1459.      returns the median of the array X.  The search for the median takes
  1460.      place along the dimension of X specified by WHICH.  WHICH defaults
  1461.      to 1, meaning the first index of X.  The median function returns an
  1462.      array with one fewer dimension than its argument X (the WHICH
  1463.      dimension of X is missing in the result), in exact analogy with
  1464.      rank reducing index range functions.  If dimsof(X)(WHICH) is
  1465.      odd, the result will have the same data type as X; if even, the
  1466.      result will be a float or a double, since the median is defined
  1467.      as the arithmetic mean between the two central values in that
  1468.      case.
  1469.    SEE ALSO: sort, built-in index range functions such as avg, rms
  1470.  */
  1471.  
  1472.                                                                       merge
  1473. /* DOCUMENT merge(true_expr, false_expr, condition)
  1474.      returns the values TRUE_EXPR or FALSE_EXPR where CONDITION is
  1475.      non-zero or zero, respectively.  The result has the data type of
  1476.      TRUE_EXPR or FALSE_EXPR, promoted to the higher arithmetic type
  1477.      if necessary.  The result has the dimensions of CONDITION.
  1478.      The number of elements in TRUE_EXPR must match the number of
  1479.      non-zero elements of CONDITION, and the number of elements in
  1480.      FALSE_EXPR must match the number of zero elements of CONDITION.
  1481.      (TRUE_EXPR or FALSE_EXPR should be nil if there are no such
  1482.      elements of CONDITION.  Normally, TRUE_EXPR and FALSE_EXPR should
  1483.      be 1-D arrays if they are not nil.)
  1484.      This function is intended for vectorizing a function whose
  1485.      domain is divided into two or more parts, as in:
  1486.         func f(x) {
  1487.       big= (x>=threshhold);
  1488.       wb= where(big);
  1489.       ws= where(!big);
  1490.       if (is_array(wb)) {
  1491.         xx= x(wb);
  1492.         fb= <function of xx>
  1493.       }
  1494.       if (is_array(ws)) {
  1495.         xx= x(ws);
  1496.         fs= <function of xx>
  1497.       }
  1498.       return merge(fb, fs, big);
  1499.     }
  1500.    SEE ALSO: merge2, where
  1501.  */
  1502.  
  1503.                                                         FROM merge2 TO open
  1504.  
  1505.                                                                      merge2
  1506. /* DOCUMENT merge2(true_expr, false_expr, condition)
  1507.      returns the values TRUE_EXPR or FALSE_EXPR where CONDITION is
  1508.      non-zero or zero, respectively.  The result has the data type of
  1509.      TRUE_EXPR or FALSE_EXPR, promoted to the higher arithmetic type
  1510.      if necessary.  Unlike the merge function, TRUE_EXPR and FALSE_EXPR
  1511.      must be conformable with each other, and with the CONDITION.
  1512.    SEE ALSO: merge2, where
  1513.  */
  1514.  
  1515.                                                                         min
  1516. /* DOCUMENT min(x)
  1517.          or min(x, y, z, ...)
  1518.      returns the scalar minimum value of its array argument, or, if
  1519.      more than one argument is supplied, returns an array of the
  1520.      minimum value for each array element among the several arguments.
  1521.      In the multi-argument case, the arguments must be conformable.
  1522.   SEE ALSO: max, sum, avg
  1523.  */
  1524.  
  1525.                                                                      nallof
  1526.     /* SEE allof     */
  1527.  
  1528.                                                                      nameof
  1529. /* DOCUMENT nameof(object)
  1530.      If OBJECT is a function or a structure definition, returns the
  1531.      name of the func or struct as it was defined (not necessarily
  1532.      the name of the variable passed to the nameof function).
  1533.   SEE ALSO: typeof
  1534.  */
  1535.  
  1536.                                                                      noneof
  1537.     /* SEE allof     */
  1538.  
  1539.                                                                    numberof
  1540. /* DOCUMENT numberof(object)
  1541.      returns the number of elements if object is an array, or 0 if not.
  1542.   SEE ALSO: sizeof, dimsof, typeof, structof
  1543.  */
  1544.  
  1545.                                                                        open
  1546. /* DOCUMENT f= open(filename)
  1547.          or f= open(filename, filemode)
  1548.          or f= open(filename, filemode, errmode)
  1549.      opens the file FILENAME according to FILEMODE (both are strings).
  1550.      If ERRMODE is non-nil and non-zero, fail by returning nil F,
  1551.      otherwise failure to open or create the file is a runtime error.
  1552.  
  1553.      To use ERRMODE to check for the existence of a file:
  1554.         if (open(filename,,1)) file_exists;
  1555.     else file_does_not_exist;
  1556.  
  1557.      The return value F is an IOStream (or just stream for short).  When
  1558.      the last reference to this return value is discarded, the file will
  1559.      be closed.  The file can also be explicitly closed with the close
  1560.  
  1561.                                                          FROM open TO openb
  1562.  
  1563.      function.  The FILEMODE determines whether the file is to be
  1564.      opened in read, write, or update mode, and whether writes are
  1565.      restricted to the end-of-file (append mode).  FILEMODE also
  1566.      determines whether the file is opened as a text file or as a
  1567.      binary file.  FILEMODE can have the following values, which are
  1568.      the same as for the ANSI standard fopen function:
  1569.         "r"     - read only
  1570.         "w"     - write only, random access, existing file overwritten
  1571.     "a"     - write only, forced to end-of-file,
  1572.             existing file preserved
  1573.     "r+"    - read/write, random access, existing file preserved
  1574.     "w+"    - read/write, random access, existing file overwritten
  1575.     "a+"    - read/write, reads random access,
  1576.             writes forced to end-of-file, existing file preserved
  1577.     "rb"  "wb"  "ab"  "r+b"  "rb+"  "w+b"  "wb+"  "a+b"  "ab+"
  1578.             without b means text file, with b means binary file
  1579.      The default FILEMODE is "r" -- open an existing text file for
  1580.      reading.
  1581.  
  1582.      The read and write functions perform I/O on text files.
  1583.      I/O to binary files may be performed explicitly using the save
  1584.      and restore functions, or implicitly by using the stream variable
  1585.      F as if it were a data structure instance (e.g.- f.x refers to
  1586.      variable x in the binary file f).
  1587.   SEE ALSO: create, close, read, write, rdline, bookmark, backup,
  1588.             rename, remove, save, restore
  1589.  */
  1590.  
  1591.                                                                     open102
  1592.     /* SEE close102     */
  1593.  
  1594.                                                                       openb
  1595. /* DOCUMENT file= openb(filename)
  1596.          or file= openb(filename, clogfile)
  1597.      open the existing file FILENAME for read-only binary I/O.
  1598.      (Use updateb or createb, respectively, to open an existing file
  1599.       with read-write access or to create a new file.)
  1600.      If the CLOGFILE argument is supplied, it represents the structure
  1601.      of FILENAME in the Clog binary data description language.
  1602.      After an openb, the file variable may be used to extract variables
  1603.      from the file as if it were a structure instance.  That is, the
  1604.      expression "file.var" refers to the variable "var" in file "file".
  1605.      A complete list of the variable names present in the file may
  1606.      be obtained using the get_vars function.  If the file contains
  1607.      history records, the jt and jc functions may be used to set the
  1608.      current record -- initially, the first record is current.
  1609.      The restore function may be used to make memory copies of data
  1610.      in the file; this will be faster than a large number of
  1611.      references to "file.var".
  1612.    SEE ALSO: updateb, createb, open, cd
  1613.              show, jt, jc, restore
  1614.              get_vars, get_times, get_ncycs, get_member, has_records
  1615.              set_blocksize, dump_clog, read_clog, recover_file
  1616.          openb_hooks, open102, close102, get_addrs
  1617.  */
  1618.  
  1619.                                                     FROM openb_hooks TO pr1
  1620.  
  1621.                                                                 openb_hooks
  1622. /* DOCUMENT openb_hooks
  1623.      list of functions to be tried by openb if the file to be
  1624.      opened is not a PDB file.  By default,
  1625.        openb_hooks= _lst(_not_pdbf, _not_cdf).
  1626.      The hook functions will be called with the file as argument
  1627.      (e.g.- _not_cdf(file)), beginning with _car(openb_hooks), until
  1628.      one of them returns 0.  Note that a hook should return 0 if it
  1629.      "recognizes" the file as one that it should be able to open, but
  1630.      finds that the file is misformatted (alternatively, it could call
  1631.      error to abort the whole process).
  1632.  */
  1633.  
  1634.                                                                      orgsof
  1635. /* DOCUMENT orgsof(object)
  1636.      returns a vector of integers describing the dimensions of OBJECT.
  1637.      The format of the vector is [number of dims, origin1, origin2, ...].
  1638.      By default, dimension origins are ignored, but use_origins changes
  1639.      this.  The dimsof function returns the length of each dimension.
  1640.      *** NOTE NOTE NOTE ***
  1641.      Unless use_origins(1) is in effect, orgsof will always return
  1642.      1 for all of the originI in the list.  Thus, whether use_origins(1)
  1643.      is in effect or not, you are guaranteed that x(orgsof(x)(2)) is the
  1644.      first element of x.
  1645.   SEE ALSO: dimsof, typeof, structof, numberof, sizeof, use_origins
  1646.  */
  1647.  
  1648.                                                               pc_primitives
  1649. /* DOCUMENT pc_primitives, file
  1650.      sets FILE primitive data types to be native to IBM PC.
  1651.  */
  1652.  
  1653.                                                                          pi
  1654. /* DOCUMENT pi
  1655.      roughly 3.14159265358979323846264338327950288
  1656.  */
  1657.  
  1658.                                                                        poly
  1659. /* DOCUMENT poly(x, a0, a1, a2, ..., aN)
  1660.      returns the polynomial  A0 + A1*x + A2*x^2 + ... + AN*X^N
  1661.      The data type and dimensions of the result, and conformability rules
  1662.      for the inputs are identical to those for the expression.
  1663.  */
  1664.  
  1665.                                                                         pr1
  1666. /* DOCUMENT pr1(x)
  1667.      returns text representing expression X, equivalent to print(X)(1).
  1668.    SEE ALSO: print, swrite
  1669.  */
  1670.  
  1671.                                                  FROM print TO process_argv
  1672.  
  1673.                                                                       print
  1674. /* DOCUMENT print, object1, object2, object3, ...
  1675.          or print(object1, object2, object3, ...)
  1676.      prints an ASCII representation of the OBJECTs, in roughly the format
  1677.      they could appear in Yorick source code.  When invoked as a subroutine
  1678.      (in the first form), output is to the terminal.  When invoked as a
  1679.      function (int the second form), the output is stored as a vector of
  1680.      strings, one string per line that would have been output.
  1681.      Printing a structure definition prints the structure definition;
  1682.      printing a function prints its "func" definition; printing files,
  1683.      bookmarks, and other objects generally provides some sort of
  1684.      useful description of the object.
  1685.   SEE ALSO: pr1, print_format, write, exit, error, nameof, typeof
  1686.  */
  1687.  
  1688.                                                                print_format
  1689. /* DOCUMENT print_format, line_length, char=, short=, int=, float=,
  1690.                           double=, complex=, pointer=
  1691.      sets the format string the print function will use for each of
  1692.      the basic data types.  Yorick format strings are the same as the
  1693.      format strings for the printf function defined in the ANSI C standard.
  1694.      The default strings may be restored individually by setting the
  1695.      associated format string to ""; all defaults are restored if
  1696.      print_format is invoked with no arguments.  The default format strings
  1697.      are:  "0x%02x", "%d", "%d", "%ld", "%g", "%g", and "%g%+gi".
  1698.      Note that char and short values are converted to int before being
  1699.      passed to printf, and that float is converted to double.
  1700.      If present, an integer positional argument is taken as the line
  1701.      length; <=0 restores the default line length of 80 characters.
  1702.   SEE ALSO: print, write, nameof, typeof
  1703.  */
  1704.  
  1705.                                                                process_argv
  1706. /* DOCUMENT remaining= process_argv()
  1707.        -or- remaining= process_argv("your startup message")
  1708.      Performs standard command line processing.  This function is
  1709.      invoked by the default custom.i file (in $Y_HOME/include); you
  1710.      can also invoke it from your personal ~/Yorick/custom.i file.
  1711.      The process_argv calls get_argv, removes any arguments of
  1712.      the form "-ifilename" or "-i filename" (the latter is a pair of
  1713.      arguments.  It returns any arguments not of this form as its
  1714.      result, after including any filenames it found in the order
  1715.      they appeared on the command line.
  1716.      The optional string argument may be an array of strings to print
  1717.      a multi-line message.
  1718.  
  1719.      A Yorick package may define the function get_command_line in
  1720.      order to feed process_argv something other than get_argv.
  1721.  
  1722.    SEE ALSO: batch
  1723.  */
  1724.  
  1725.                                                     FROM ptcen TO randomize
  1726.  
  1727.                                                                       ptcen
  1728. /* DOCUMENT ptcen(zncen)
  1729.          or ptcen(zncen, ireg)
  1730.      returns point centered version of the 2-D zone centered array ZNCEN.
  1731.      The result is imax-by-jmax if ZNCEN is (imax-1)-by-(jmax-1).
  1732.      If the region number array IREG is specified, zones with region
  1733.      number 0 are not included in the point centering operation.
  1734.      Note that IREG should have dimensions imax-by-jmax; the first
  1735.      row and column of IREG are ignored.
  1736.      Without IREG, ptcen(zncen) is equivalent to zncen(pcen,pcen).
  1737.   SEE ALSO: zncen, uncen
  1738.  */
  1739.  
  1740.                                                                        quit
  1741. /* DOCUMENT quit
  1742.      Exit YMainLoop when current task finishes.
  1743.      Normally this terminates the program.
  1744.  */
  1745.  
  1746.                                                                      random
  1747. /* DOCUMENT random(dimension_list)
  1748.             random_seed, seed
  1749.      returns an array of random double values with the given
  1750.      DIMENSION_LIST (nil for a scalar result), uniformly distributed
  1751.      on the interval from 0.0 to 1.0.
  1752.      The algorithm is from Press and Teukolsky, Computers in Physics,
  1753.      vol. 6, no. 5, Sep/Oct 1992 (ran2).  They offer a reward of $1000
  1754.      to anyone who can exhibit a statistical test that this random
  1755.      number generator fails in a "non-trivial" way.
  1756.      The random_seed call reinitializes the random number sequence;
  1757.      SEED should be between 0.0 and 1.0 non-inclusive; if SEED is
  1758.      omitted, nil, or out of range, the sequence is reinitialized as
  1759.      when Yorick starts.
  1760.      The numbers are actually at the centers of 2147483562 equal width
  1761.      bins on the interval [0,1].  Although only these 2 billion numbers
  1762.      are possible, the period of the generator is roughly 2.3e18.
  1763.  
  1764.    SEE ALSO: randomize
  1765.  */
  1766.  
  1767.                                                                 random_seed
  1768.     /* SEE random     */
  1769.  
  1770.                                                                   randomize
  1771. /* DOCUMENT randomize
  1772.             randomize()
  1773.      set the seed for random "randomly" (based on the timer clock
  1774.      and the current state of random).  As a function, returns the
  1775.      value of the seed passed to random_seed.
  1776.  
  1777.    SEE ALSO: random, random_seed
  1778.  */
  1779.  
  1780.                                                         FROM rdline TO read
  1781.  
  1782.                                                                      rdline
  1783. /* DOCUMENT rdline(f)
  1784.          or rdline(f, n, prompt= pstring)
  1785.      returns next line from stream F (stdin if F nil).  If N is non-nil,
  1786.      returns a string array containing the next N lines of F.  If
  1787.      end-of-file occurs, rdline returns nil strings.  If F is nil,
  1788.      uses the PSTRING to prompt for input (default "read> ").
  1789.    SEE ALSO: read, open, close, bookmark, backup, read_n
  1790.  */
  1791.  
  1792.                                                                        read
  1793. /* DOCUMENT n= read(f, format=fstring, obj1, obj2, ...)
  1794.          or n= read(prompt= pstring, format=fstring, obj1, obj2, ...)
  1795.      or n= sread(source, format=fstring, obj1, obj2, ...)
  1796.      reads text from I/O stream F (1st form), or from the keyboard (2nd
  1797.      form), or from the string or string array SOURCE (3rd form),
  1798.      interprets it according to the optional FSTRING, and uses that
  1799.      interpretation to assign values to OBJ1, OBJ2, ...  If the input
  1800.      is taken from the keyboard, the optional prompt PSTRING (default
  1801.      "read> ") is printed before each line is read.  The Yorick write
  1802.      function does not interact with the read function -- writes are
  1803.      always to end-of-file, and do not affect the sequence of lines
  1804.      returned by read.  The backup (and bookmark) function is the
  1805.      only way to change the sequence of lines returned by read.
  1806.  
  1807.      There must be one non-supressed conversion specifier (see below)
  1808.      in FSTRING for each OBJ to be read; the type of the conversion
  1809.      specifier must generally match the type of the OBJ.  That is,
  1810.      an integer OBJ requires an integer specifier (d, i, o, u, or x)
  1811.      in FSTRING, a real OBJ requires a real specifier (e, f, or g),
  1812.      and a string OBJ requires a string specifier (s or []).  An OBJ
  1813.      may not be complex, a pointer, a structure instance, or any non-
  1814.      array Yorick object.  If FSTRING is not supplied, or if it has
  1815.      fewer conversion specifiers than the number of OBJ arguments,
  1816.      then Yorick supplies default specifiers ("%ld" for integers,
  1817.      "%lg" for reals, and "%s" for strings).  If FSTRING contains more
  1818.      specifiers than there are OBJ arguments, the part of FSTRING
  1819.      beginning with the first specifier with no OBJ is ignored.
  1820.  
  1821.      The OBJ may be scalar or arrays, but the dimensions of every OBJ
  1822.      must be identical.  If the OBJ are arrays, Yorick behaves as
  1823.      if the read were called in a loop numberof(OBJ1) times, filling
  1824.      one array element of each of the OBJ according to FSTRING on
  1825.      each pass through the loop.  (Note that this behavior includes
  1826.      the case of reading columns of numbers by a single call to read.)
  1827.  
  1828.      The return value N is the total number of scalar assignments
  1829.      which were made as a result of this call.  (If there were 4
  1830.      OBJ arguments, and each was an array with 17 elements, a return
  1831.      value of N==35 would mean the following:  The first 8 elements
  1832.      of OBJ1, OBJ2, OBJ3, and OBJ4 were read, and the 9th element of
  1833.      OBJ1, OBJ2, and OBJ3 was read.)  The read function sets any
  1834.      elements of the OBJ which were not read to zero -- hence,
  1835.      independent of the returned N, the all of the old data in the
  1836.      OBJ arguments is overwritten.
  1837.  
  1838.                                                           FROM read TO read
  1839.  
  1840.  
  1841.      The read or sread functions continue reading until either:
  1842.      (1) all elements of all OBJ have been filled, or (2) end-of-file
  1843.      (or end of SOURCE for sread) is reached ("input failure"), or
  1844.      (3) part of FSTRING or a conversion specifier supplied by
  1845.      default fails to match the source text ("matching failure").
  1846.  
  1847.      The FSTRING is composed of a series of "directives" which are
  1848.      (1) whitespace -- means to skip any amount of whitespace in the
  1849.          source text
  1850.      (2) characters other than whitespace and % -- must match the
  1851.          characters in the source text exactly, or matching failure
  1852.      occurs and the read operation stops
  1853.      (3) conversion specifiers beginning with % and ending with a
  1854.          character specifying the type of conversion -- optionally
  1855.      skip whitespace, then convert as many characters as
  1856.      continue to "look like" the conversion type, possibly
  1857.      producing a matching failure
  1858.      The conversion specifier is of the form %*WSC, where:
  1859.      * is either the character '*' or not present
  1860.        A specifier beginning with %* does not correspond to any of
  1861.        the OBJ; the converted value will be discarded.
  1862.      W is either a positive decimal integer specifying the maximum
  1863.        field width (not including any skipped leading whitespace),
  1864.        or not present if any number of characters up to end-of-line
  1865.        is acceptable.
  1866.      S is either one of the characters 'h', 'l', or 'L', or not
  1867.        present.  Yorick allows this for compatibility with the C
  1868.        library functions, but ignores it.
  1869.      C is a character specifying the type of conversion:
  1870.        d   - decimal integer
  1871.        i   - decimal, octal (leading 0), or hex (leading 0x) integer
  1872.        o   - octal integer
  1873.        u   - unsigned decimal integer (same as d for Yorick)
  1874.        x, X            - hex integer
  1875.        e, f, g, E, G   - floating point real
  1876.        s   - string of non-whitespace characters
  1877.        [xxx]   - (xxx is any sequence of characters) longest string
  1878.                  of characters matching those in the list
  1879.        [^xxx]  - longest string of characters NOT matching those in
  1880.                  the list (this is how you can extend %s to be
  1881.          delimited by something other than whitespace)
  1882.        %   - the ordinary % character; complete conversion
  1883.              specification must be "%%"
  1884.  
  1885.      The read function is modeled on the ANSI standard C library
  1886.      fscanf and sscanf functions, but differs in several respects:
  1887.        (1) Yorick's read cannot handle the %c, %p, or %n conversion
  1888.            specifiers in FSTRING.
  1889.        (2) Yorick's read never results in a portion of a line
  1890.            being read -- any unused part of a line is simply discarded
  1891.        (end FSTRING with "%[^\n]" if you want to save the trailing
  1892.        part of an input line).
  1893.  
  1894.                                                        FROM read TO reshape
  1895.  
  1896.        (3) As a side effect of (2), there are some differences between
  1897.            fscanf and Yorick's read in how whitespace extending across
  1898.        newlines is handled.
  1899.    SEE ALSO: rdline, write, open, close, bookmark, backup, save, restore,
  1900.              read_n
  1901.  */
  1902.  
  1903.                                                                   read_clog
  1904. /* DOCUMENT file= read_clog(file, clog_name)
  1905.      raw routine to set the binary data structure of FILE according
  1906.      to the text description in the Contents Log file CLOG_NAME.
  1907.  */
  1908.  
  1909.                                                                      read_n
  1910. /* DOCUMENT read_n, f, n0, n1, n2, ...
  1911.      grabs the next numbers N0, N1, N2, ... from file F, skipping over
  1912.      any whitespace, comma, semicolon, or colon delimited tokens which
  1913.      are not numbers.  (Actually, only the first and last characters of
  1914.      the token have to look like a number -- 4xxx3 would be read as 4.)
  1915.      ***WARNING*** at most ten Ns are allowed
  1916.      The Ns can be arrays, provided all have the same dimensions.
  1917.    SEE ALSO: read, rdline
  1918.  */
  1919.  
  1920.                                                                recover_file
  1921. /* DOCUMENT recover_file, filename
  1922.          or recover_file, filename, clogfile
  1923.      writes the descriptive information at the end of a corrupted
  1924.      binary file FILENAME from its Contents Log file CLOGFILE, which
  1925.      is FILENAME+"L" by default.
  1926.  */
  1927.  
  1928.                                                                      remove
  1929.     /* SEE rename     */
  1930.  
  1931.                                                                      rename
  1932. /* DOCUMENT rename, old_filename, new_filename
  1933.             remove filename
  1934.      rename or remove a file.
  1935.    SEE ALSO: open, close, openb, closeb
  1936.  */
  1937.  
  1938.                                                                     require
  1939.     /* SEE include     */
  1940.  
  1941.                                                                     reshape
  1942. /* DOCUMENT reshape, reference, address, type, dimension_list
  1943.          or reshape, reference, type, dimension_list
  1944.          or reshape, reference
  1945.      The REFERENCE must be an unadorned variable, not an expression;
  1946.      reshape sets this variable to an LValue at the specified ADDRESS
  1947.      with the specified TYPE and DIMENSION_LIST.  (See the array
  1948.      function documentation for acceptable DIMENSION_LIST formats.)
  1949.      If ADDRESS is an integer (e.g.- a long), the programmer is
  1950.      responsible for assuring that the data at ADDRESS is valid.
  1951.  
  1952.                                                        FROM reshape TO sech
  1953.  
  1954.      If ADDRESS is a (Yorick) pointer, Yorick will assure that the
  1955.      data pointed to will not be discarded, and the reshape will
  1956.      fail if TYPE and DIMENSION_LIST extend beyond the pointee
  1957.      bounds.  In the second form, ADDRESS is taken to be &REFERENCE;
  1958.      that is, the TYPE and DIMENSION_LIST of the variable are changed
  1959.      without doing any type conversion.  In the third form, REFERENCE
  1960.      is set to nil ([]).  (Simple redefinition will not work on a
  1961.      variable defined using reshape.)
  1962.      WARNING: There are almost no situations for which reshape is
  1963.        the correct operation.  See reform in Y_SITE/include/string.i.
  1964.   SEE ALSO: array, dimsof, numberof, is_array, eq_nocopy
  1965.  */
  1966.  
  1967.                                                                     restore
  1968.     /* SEE save     */
  1969.  
  1970.                                                                        save
  1971. /* DOCUMENT save, file, var1, var2, ...
  1972.             restore, file, var1, var2, ...
  1973.      saves the variables VAR1, VAR2, etc. in the binary file FILE,
  1974.      or restores them from that file.
  1975.      The VARi may be either non-record or record data in the case that
  1976.      FILE contains records.
  1977.  
  1978.      If one of the VARi does not already exist in FILE, it is created
  1979.      by the save command; after add_record, save adds or stores VARi to
  1980.      the current record.  See add_record for more.  The VARi may be
  1981.      structure definitions (for the save command) to declare data
  1982.      structures for the file.  This is necessary only in the case that
  1983.      a record variable is a pointer -- all of the potential data types
  1984.      of pointees must be known.  No data structures may be declared
  1985.      using the save command after the first record has been added.
  1986.  
  1987.      If no VARi are present, save saves all array variables, and
  1988.      restore restores every non-record variable in the file if there
  1989.      is no current record, and every variable in the current record if
  1990.      there is one.
  1991.    SEE ALSO: openb, createb, updateb, get_vars, add_record, get_addrs
  1992.              jt, jc, _read, _write, data_align
  1993.  */
  1994.  
  1995.                                                                        sech
  1996. /* DOCUMENT sech(x)
  1997.             csch(x)
  1998.      returns the hyperbolic secant (1/cosh) or cosecant (1/sinh) of
  1999.      its argument, without overflowing for large x.
  2000.   SEE ALSO: sinh, cosh, tanh, asinh, acosh, atanh
  2001.  */
  2002.  
  2003.                                              FROM set_blocksize TO set_path
  2004.  
  2005.                                                               set_blocksize
  2006. /* DOCUMENT set_blocksize, file, blocksize
  2007.      sets smallest cache block size for FILE to BLOCKSIZE.  BLOCKSIZE
  2008.      is rounded to the next larger number of the form 4096*2^n if
  2009.      necessary; cache blocks for this file will be multiples of
  2010.      BLOCKSIZE bytes long.  The default BLOCKSIZE is 0x4000 (16 KB).
  2011.    SEE ALSO: openb, updateb, createb, save, restore, _read, _write
  2012.  */
  2013.  
  2014.                                                                set_filesize
  2015. /* DOCUMENT set_filesize, file, filesize
  2016.      sets the new family member threshhold for FILE to FILESIZE.
  2017.      Whenever a new record is added (see add_record), if the current file
  2018.      in the FILE family has at least one record and the new record would
  2019.      cause the current file to exceed FILESIZE bytes, a new family
  2020.      member will be created to hold the new record.
  2021.      The default FILESIZE is 0x400000 (4 MB).
  2022.    SEE ALSO: openb, updateb, createb, add_record
  2023.  */
  2024.  
  2025.                                                                   set_idler
  2026. /* DOCUMENT set_idler, idler_function
  2027.      sets the idler function to IDLER_FUNCTION.  Instead of waiting
  2028.      for keyboard input when all its tasks are finished, the interpreter
  2029.      will invoke IDLER_FUNCTION with no arguments.  The idler function
  2030.      is normally invoked only once, so input from the keyboard resumes
  2031.      after one call to the idler.  Of course, an idler is free to call
  2032.      set_idler again before it returns, which will have the effect of
  2033.      calling that function in a loop.
  2034.    SEE ALSO: batch
  2035.  */
  2036.  
  2037.                                                                    set_path
  2038. /* DOCUMENT set_path, "dir1:dir2:dir3:..."
  2039.          or set_path
  2040.      sets the include file search path to the specified list of
  2041.      directories.  The specified directories are searched left to
  2042.      right for include files specified as relative file names in
  2043.      #include directives, or to the include or require functions.
  2044.      If the argument is omitted, restores the default search path,
  2045.      ".:~/Yorick:Y_LAUNCH/include:Y_SITE/include:Y_SITE/contrib",
  2046.      where y_site is the main Yorick directory for this site.
  2047.      The Y_LAUNCH directory is the directory which contains the
  2048.      executable; this directory is omitted if it is the same as
  2049.      Y_SITE.
  2050.  
  2051.      Only the "end user" should ever call set_path, and then only in
  2052.      his or her custom.i file, for the purpose of placing a more
  2053.      elaborate set of personal directories containing Yorick procedures.
  2054.      For example, if someone else maintains Yorick code you use, you
  2055.      might put their ~/Yorick on your include path.
  2056.  
  2057.    SEE ALSO: Y_LAUNCH, Y_SITE, include, require
  2058.  */
  2059.  
  2060.                                                           FROM show TO sort
  2061.  
  2062.                                                                        show
  2063. /* DOCUMENT show, f
  2064.          or show, f, pat
  2065.          or show, f, 1
  2066.      prints a summary of the variables contained in binary file F.
  2067.      If there are too many variables, use the second form to select
  2068.      only those variables whose first few characters match PAT.
  2069.      In the third form, continues the previous show command where it
  2070.      left off -- this may be necessary for files with large numbers of
  2071.      variables.
  2072.      The variables are printed in alphabetical order down the columns.
  2073.      The print function can be used to obtain other information about F.
  2074.    SEE ALSO: openb, jt, jc
  2075.  */
  2076.  
  2077.                                                                        sign
  2078. /* DOCUMENT sign(x)
  2079.      returns algebraic sign of it argument, or closest point on the
  2080.      unit circle for complex x.  Guaranteed that x==sign(x)*abs(x).
  2081.      sign(0)==+1.
  2082.   SEE ALSO: abs
  2083.  */
  2084.  
  2085.                                                                         sin
  2086. /* DOCUMENT sin(x)
  2087.             cos(x)
  2088.             tan(x)
  2089.      returns the sine, cosine, or tangent of its argument,
  2090.      which is in radians.
  2091.   SEE ALSO: asin, acos, atan
  2092.  */
  2093.  
  2094.                                                                        sinh
  2095. /* DOCUMENT sinh(x)
  2096.             cosh(x)
  2097.             tanh(x)
  2098.      returns the hyperbolic sine, cosine, or tangent of its argument.
  2099.   SEE ALSO: sech, csch, asinh, acosh, atanh
  2100.  */
  2101.  
  2102.                                                                      sizeof
  2103. /* DOCUMENT sizeof(object)
  2104.      returns the size of the object in bytes, or 0 for non-array objects.
  2105.      sizeof(structure_definition) returns the number of bytes per instance.
  2106.      sizeof(binary_file) returns the file size in bytes.
  2107.   SEE ALSO: dimsof, typeof, structof, numberof
  2108.  */
  2109.  
  2110.                                                                        sort
  2111. /* DOCUMENT sort(x)
  2112.          or sort(x, which)
  2113.      returns an array of longs with dimsof(X) containing index values
  2114.      such that X(sort(X)) is a monotonically increasing array.  X can
  2115.      contain integer, real, or string values.  If X has more than one
  2116.      dimension, WHICH determines the dimension to be sorted.  The
  2117.  
  2118.                                                          FROM sort TO sread
  2119.  
  2120.      default WHICH is 1, corresponding to the first dimension of X.
  2121.      WHICH can be non-positive to count dimensions from the end of X;
  2122.      in particular a WHICH of 0 will sort the final dimension of X.
  2123.  
  2124.      WARNING: The sort function is non-deterministic if some of the
  2125.               values of X are equal, because the Quick Sort algorithm
  2126.           involves a random selection of a partition element.
  2127.  
  2128.      For information on sorting with multiple keys (and on making
  2129.      sort deterministic), type the following:
  2130.         #include "msort.i"
  2131.         help, msort
  2132.  
  2133.    SEE ALSO: median, digitize, interp, integ, histogram
  2134.  */
  2135.  
  2136.                                                                        span
  2137. /* DOCUMENT span(start, stop, n)
  2138.          or span(start, stop, n, which)
  2139.      returns array of N doubles equally spaced from START to STOP.
  2140.      The START and STOP arguments may themselves be arrays, as long as
  2141.      they are conformable.  In this case, the result will have one
  2142.      dimension of length N in addition to dimsof(START, STOP).
  2143.      By default, the result will be N-by-dimsof(START, STOP), but
  2144.      if WHICH is specified, the new one of length N will be the
  2145.      WHICHth.  WHICH may be non-positive to position the new
  2146.      dimension relative to the end of dimsof(START, STOP); in
  2147.      particular WHICH of 0 produces a result with dimensions
  2148.      dimsof(START, STOP)-by-N.
  2149.    SEE ALSO: spanl, indgen, array
  2150.  */
  2151.  
  2152.                                                                       spanl
  2153. /* DOCUMENT spanl(start, stop, n)
  2154.          or spanl(start, stop, n, which)
  2155.      similar to the span function, but the result array have N points
  2156.      spaced at equal ratios from START to STOP (that is, equally
  2157.      spaced logarithmically).  See span for discussion of WHICH argument.
  2158.      START and STOP must have the same algebraic sign for this to make
  2159.      any sense.
  2160.    SEE ALSO: span, indgen, array
  2161.  */
  2162.  
  2163.                                                                        sqrt
  2164. /* DOCUMENT sqrt(x)
  2165.      returns the square root of its argument.
  2166.   SEE ALSO: abs, also note the rms range function
  2167.  */
  2168.  
  2169.                                                                       sread
  2170.     /* SEE read     */
  2171.  
  2172.                                                       FROM strlen TO strtok
  2173.  
  2174.                                                                      strlen
  2175. /* DOCUMENT strlen(string_array)
  2176.      returns an long array with dimsof(STRING_ARRAY) containing the
  2177.      lengths of the strings.  The null string (0) is considered to
  2178.      have length 0, just like "".
  2179.    SEE ALSO: strmatch, strpart, strtok
  2180.  */
  2181.  
  2182.                                                                    strmatch
  2183. /* DOCUMENT strmatch(string_array, pattern)
  2184.          or strmatch(string_array, pattern, case_fold)
  2185.      returns an int array with dimsof(STRING_ARRAY) with 0 where
  2186.      PATTERN was not found in STRING_ARRAY and 1 where it was found.
  2187.      If CASE_FOLD is specified and non-0, the pattern match is
  2188.      insensitive to case, that is, an upper case letter will match
  2189.      the same lower case letter and vice-versa.
  2190.    SEE ALSO: strtok, strpart, strlen
  2191.  */
  2192.  
  2193.                                                                     strpart
  2194. /* DOCUMENT strpart(string_array, m:n)
  2195.       returns another string array with the same dimensions as
  2196.       STRING_ARRAY which consists of characters M through N of
  2197.       the original strings.  M and N are 1-origin indices; if
  2198.       M is omitted, the default is 1; if N is omitted, the default
  2199.       is the end of the string.  If M or N is non-positive, it is
  2200.       interpreted as an index relative to the end of the string,
  2201.       with 0 being the last character, -1 next to last, etc.
  2202.       Finally, the returned string will be shorter than N-M+1
  2203.       characters if the original doesn't have an Mth or Nth
  2204.       character, with "" (note that this is otherwise impossible)
  2205.       if neither an Mth nor an Nth character exists.  A 0
  2206.       is returned for any string which was 0 on input.
  2207.    SEE ALSO: strmatch, strtok, strlen
  2208.  */
  2209.  
  2210.                                                                      strtok
  2211. /* DOCUMENT strtok(string_array, delimiters)
  2212.          or strtok(string_array)
  2213.      strips the first token off of each string in STRING_ARRAY.
  2214.      A token is delimited by any of the characters in the string
  2215.      DELIMITERS.  If DELIMITERS is blank, nil, or not given, the
  2216.      default DELIMITERS is " \t\n" (blanks, tabs, or newlines).
  2217.      The result is a string array ts with dimensions
  2218.      2-by-dimsof(STRING_ARRAY); ts(1,) is the first token, and
  2219.      ts(2,) is the remainder of the string (the character which
  2220.      terminated the first token will be in neither of these parts).
  2221.      The ts(2,) part will be 0 (i.e.- the null string) if no more
  2222.      characters remain after ts(1,); the ts(1,) part will be 0 if
  2223.      no token was present.  A STRING_ARRAY element may be 0, in
  2224.      which case (0, 0) is returned for that element.
  2225.    SEE ALSO: strmatch, strpart, strlen
  2226.  */
  2227.  
  2228.                                             FROM struct_align TO symbol_def
  2229.  
  2230.                                                                struct_align
  2231. /* DOCUMENT struct_align, file, alignment
  2232.      in binary file FILE, align new struct members which are themselves
  2233.      struct instances to begin at a byte address which is a multiple of
  2234.      ALIGNMENT.  (This affects members declared explicitly by add_member,
  2235.      as well as implicitly by save or add_variable.)  If ALIGNMENT is <=0,
  2236.      returns to the default for this machine.  The struct alignment is in
  2237.      addition to the alignment implied by the most restrictively aligned
  2238.      member of the struct.  Most machines want ALIGNMENT of 1.
  2239.    SEE ALSO: add_member
  2240.  */
  2241.  
  2242.                                                                    structof
  2243. /* DOCUMENT structof(object)
  2244.      returns the data type of OBJECT, or nil for non-array OBJECTs.
  2245.      Use typeof(object) to get the ASCII name of a the data type.
  2246.   SEE ALSO: typeof, dimsof, numberof, sizeof, nameof
  2247.  */
  2248.  
  2249.                                                                         sum
  2250. /* DOCUMENT sum(x)
  2251.      returns the scalar sum of all elements of its array argument.
  2252.   SEE ALSO: avg, min, max
  2253.  */
  2254.  
  2255.                                                             sun3_primitives
  2256. /* DOCUMENT sun3_primitives, file
  2257.      sets FILE primitive data types to be native to Sun-2 or Sun-3.
  2258.  */
  2259.  
  2260.                                                              sun_primitives
  2261. /* DOCUMENT sun_primitives, file
  2262.      sets FILE primitive data types to be native to Sun, HP, IBM, etc.
  2263.  */
  2264.  
  2265.                                                                      swrite
  2266.     /* SEE write     */
  2267.  
  2268.                                                                  symbol_def
  2269. /* DOCUMENT symbol_def(func_name)(arglist)
  2270.          or symbol_def(var_name)
  2271.      invokes the function FUNC_NAME with the specified ARGLIST,
  2272.      returning the return value.  ARGLIST may be zero or more arguments.
  2273.      In fact, symbol_def("fname")(arg1, arg2, arg3) is equivalent to
  2274.      fname(arg1, arg2, arg3), so that "fname" can be the name of any
  2275.      variable for which the latter syntax is meaningful -- interpreted
  2276.      function, built-in function, or array.
  2277.  
  2278.      Without an argument list, symbol_def("varname") is equivalent to
  2279.      varname, which allows you to get the value of a variable whose name
  2280.      you must compute.
  2281.  
  2282.      DO NOT OVERUSE THIS FUNCTION.  It works around a specific deficiency
  2283.  
  2284.                                                    FROM symbol_def TO timer
  2285.  
  2286.      of the Yorick language -- the lack of pointers to functions -- and
  2287.      should be used for such purposes as hook lists (see openb).
  2288.  
  2289.    SEE ALSO: symbol_set
  2290.  */
  2291.  
  2292.                                                                  symbol_set
  2293. /* DOCUMENT symbol_set, var_name, value
  2294.      is equivalent to the redefinition
  2295.           varname= value
  2296.      except that var_name="varname" is a string which must be computed.
  2297.  
  2298.      DO NOT OVERUSE THIS FUNCTION.  It works around a specific deficiency
  2299.      of the Yorick language -- the lack of pointers to functions, streams,
  2300.      bookmarks, and other special non-array data types.
  2301.  
  2302.    SEE ALSO: symbol_def
  2303.  */
  2304.  
  2305.                                                                      system
  2306. /* DOCUMENT system, "shell command line"
  2307.      Passes the command line string to a shell for execution.
  2308.      If the string is constant, you may use the special syntax:
  2309.          $shell command line
  2310.      (A long command line may be continued by ending the line with \
  2311.      as usual.)  The system function syntax allows Yorick to compute
  2312.      parts of the command line string, while the simple $ escape
  2313.      syntax does not.  In either case, the only way to get output
  2314.      back from such a command is to redirect it to a file, then
  2315.      read the file.  Note that Yorick does not regain control
  2316.      until the subordinate shell finishes.  (Yorick will get control
  2317.      back if the command line backgrounds the job.)
  2318.  */
  2319.  
  2320.                                                                         tan
  2321.     /* SEE sin     */
  2322.  
  2323.                                                                        tanh
  2324.     /* SEE sinh     */
  2325.  
  2326.                                                                       timer
  2327. /* DOCUMENT timer, elapsed
  2328.          or timer, elapsed, split
  2329.      updates the ELAPSED and optionally SPLIT timing arrays.  These
  2330.      arrays must each be of type array(double,3); the layout is
  2331.      [cpu, system, wall], with all three times measured in seconds.
  2332.      ELAPSED is updated to the total times elapsed since this copy
  2333.      of Yorick started.  SPLIT is incremented by the difference between
  2334.      the new values of ELAPSED and the values of ELAPSED on entry.
  2335.      This feature allows for primitive code profiling by keeping
  2336.      separate accounting of time usage in several categories, e.g.--
  2337.         elapsed= total= cat1= cat2= cat3= array(double, 3);
  2338.         timer, elapsed0;
  2339.     elasped= elapsed0;
  2340.         ... category 1 code ...
  2341.  
  2342.                                                     FROM timer TO transpose
  2343.  
  2344.     timer, elapsed, cat1;
  2345.         ... category 2 code ...
  2346.     timer, elapsed, cat2;
  2347.         ... category 3 code ...
  2348.     timer, elapsed, cat3;
  2349.         ... more category 2 code ...
  2350.     timer, elapsed, cat2;
  2351.         timer, elapsed0, total;
  2352.      The wall time is not absolutely reliable, owning to possible
  2353.      rollover at midnight.
  2354.    SEE ALSO: timestamp, timer_print
  2355.  */
  2356.  
  2357.                                                                 timer_print
  2358. /* DOCUMENT timer_print, label1, split1, label2, split2, ...
  2359.          or timer_print
  2360.          or timer_print, label_total
  2361.      prints out a timing summary for splits accumulated by timer.
  2362.         timer_print, "category 1", cat1, "category 2", cat2,
  2363.                      "category 3", cat3, "total", total;
  2364.    SEE ALSO: timer
  2365.  */
  2366.  
  2367.                                                                   timestamp
  2368. /* DOCUMENT timestamp()
  2369.      returns string of the form "Sun Jan  3 15:14:13 1988" -- always
  2370.      has 24 characters.
  2371.    SEE ALSO: timer
  2372.  */
  2373.  
  2374.                                                                   transpose
  2375. /* DOCUMENT transpose(x)
  2376.          or transpose(x, permutation1, permutation2, ...)
  2377.      transpose the first and last dimensions of array X.  In the second
  2378.      form, each PERMUTATION specifies a simple permutation of the
  2379.      dimensions of X.  These permutations are compounded left to right
  2380.      to determine the final permutation to be applied to the dimensions
  2381.      of X.  Each PERMUTATION is either an integer or a 1D array of
  2382.      integers.  A 1D array specifies a cyclic permutation of the
  2383.      dimensions as follows: [3, 5, 2] moves the 3rd dimension to the
  2384.      5th dimension, the 5th dimension to the 2nd dimension, and the 2nd
  2385.      dimension to the 3rd dimension.  Non-positive numbers count from the
  2386.      end of the dimension list of X, so that 0 is the final dimension,
  2387.      -1 in the next to last, etc.  A scalar PERMUTATION is a shorthand
  2388.      for a cyclic permutation of all of the dimensions of X.  The value
  2389.      of the scalar is the dimension to which the 1st dimension will move.
  2390.  
  2391.      Examples:  Let x have dimsof(x) equal [6, 1,2,3,4,5,6] in order
  2392.         to be able to easily identify a dimension by its length. Then:
  2393.     dimsof(x)                          == [6, 1,2,3,4,5,6]
  2394.     dimsof(transpose(x))               == [6, 6,2,3,4,5,1]
  2395.         dimsof(transpose(x,[1,2]))         == [6, 2,1,3,4,5,6]
  2396.     dimsof(transpose(x,[1,0]))         == [6, 6,2,3,4,5,1]
  2397.  
  2398.                                               FROM transpose TO use_origins
  2399.  
  2400.     dimsof(transpose(x,2))             == [6, 6,1,2,3,4,5]
  2401.     dimsof(transpose(x,0))             == [6, 2,3,4,5,6,1]
  2402.     dimsof(transpose(x,3))             == [6, 5,6,1,2,3,4]
  2403.     dimsof(transpose(x,[4,6,3],[2,5])) == [6, 1,5,6,3,2,4]
  2404.  */
  2405.  
  2406.                                                                      typeof
  2407. /* DOCUMENT typeof(object)
  2408.      returns a string describing the type of object.  For the basic
  2409.      data types, these are "char", "short", "int", "long", "float",
  2410.      "double", "complex", "string", "pointer", "struct_instance",
  2411.      "void", "range", "struct_definition", "function", "builtin",
  2412.      and "stream".
  2413.   SEE ALSO: structof, dimsof, sizeof, numberof, nameof
  2414.  */
  2415.  
  2416.                                                                       uncen
  2417. /* DOCUMENT uncen(ptcen)
  2418.          or uncen(ptcen, ireg)
  2419.      returns zone centered version of the 2-D zone centered array PTCEN.
  2420.      The result is (imax-1)-by-(jmax-1) if PTCEN is imax-by-jmax.
  2421.      If the region number array IREG is specified, zones with region
  2422.      number 0 are not included in the point centering operation.
  2423.      Note that IREG should have dimensions imax-by-jmax, like
  2424.      the input PTCEN array; the first row and column of IREG are ignored.
  2425.      Without IREG, uncen(ptcen) is equivalent to ptcen(uncp,uncp).
  2426.  
  2427.      Do not use uncen to zone center data which is naturally point
  2428.      centered -- use the zncen function for that purpose.  The uncen
  2429.      function is the (nearly) exact inverse of the ptcen function,
  2430.      so that uncen(ptcen(zncen, ireg), ireg) will return the original
  2431.      zncen array.  The uncen reconstruction is as exact as possible,
  2432.      given the finite precision of floating point operations.
  2433.   SEE ALSO: ptcen, zncen
  2434.  */
  2435.  
  2436.                                                                     updateb
  2437. /* DOCUMENT file= updateb(filename)
  2438.          or file= updateb(filename, primitives)
  2439.      open a binary date file FILENAME for update (mode "r+b").
  2440.      The optional PRIMITIVES argument is as for the createb function.
  2441.      If the file exists, it is opened as if by openb(filename),
  2442.      otherwise a new PDB file is created as if by createb(filename).
  2443.    SEE ALSO: openb, createb, cd, save, restore, get_vars, get_addrs
  2444.              close102, close102_default, open102, at_pdb_open, at_pdb_close
  2445.  */
  2446.  
  2447.                                                                 use_origins
  2448. /* DOCUMENT dummy= use_origins(dont_force)
  2449.      Yorick array dimensions have an origin as well as a length.
  2450.      By default, this origin is 1 (like FORTRAN arrays, unlike C
  2451.      arrays).  However, the array function and the pseudo-index (-)
  2452.      can be used to produce arrays with other origins.
  2453.  
  2454.      Initially, the origin of an array index is ignored by Yorick; the
  2455.  
  2456.                                                   FROM use_origins TO where
  2457.  
  2458.      first element of any array has index 1.  You can change this
  2459.      default behavior by calling use_origins with non-zero DONT_FORCE,
  2460.      and restore the default behavior by calling use_origins(0).
  2461.  
  2462.      When the returned object DUMMY is destroyed, either by return from
  2463.      the function in which it is a local variable, or by explicit
  2464.      redefintion of the last reference to it, the treatment of array
  2465.      index origins reverts to the behavior prior to the call to
  2466.      use_origins.  Thus, you can call use_origins at the top of a
  2467.      function and not worry about restoring the external behavior
  2468.      before every possible return (including errors).
  2469.  
  2470.   SEE ALSO: array, dimsof, orgsof
  2471.  */
  2472.  
  2473.                                                              vax_primitives
  2474. /* DOCUMENT vax_primitives, file
  2475.      sets FILE primitive data types to be native to VAXen, H-double, only.
  2476.  */
  2477.  
  2478.                                                             vaxg_primitives
  2479. /* DOCUMENT vaxg_primitives, file
  2480.      sets FILE primitive data types to be native to VAXen, G-double, only.
  2481.  */
  2482.  
  2483.                                                                      volume
  2484. /* DOCUMENT volume(r, z)
  2485.      returns the zonal volumes of the 2-D cylindrical mesh (R, Z).
  2486.      If R and Z are imax-by-jmax, the result is (imax-1)-by-(jmax-1).
  2487.      The volume is positive when, say, Z increases with i and R increases
  2488.      with j.  For example, volume([[0,0],[1,1]],[[0,1],[0,1]]) is +pi.
  2489.    SEE ALSO: area
  2490.  */
  2491.  
  2492.                                                                    warranty
  2493.     /* SEE copyright     */
  2494.  
  2495.                                                                       where
  2496. /* DOCUMENT where(x)
  2497.      returns the vector of longs which is the index list of non-zero
  2498.      values in the array x.  Thus, where([[0,1,3],[2,0,4]]) would
  2499.      return [2,3,4,6].  If noneof(x), where(x) is a special range
  2500.      function which will return a nil value if used to index an array;
  2501.      hence, if noneof(x), then x(where(x)) is nil.
  2502.      If x is a non-zero scalar, then where(x) returns a scalar value.
  2503.      The rather recondite behavior for scalars and noneof(x) provides
  2504.      maximum performance when the merge function to be used with the
  2505.      where function.
  2506.   SEE ALSO: where2, merge, merge2 allof, anyof, noneof, nallof, sort
  2507.  */
  2508.  
  2509.                                                        FROM where2 TO write
  2510.  
  2511.                                                                      where2
  2512. /* DOCUMENT where2(x)
  2513.      like where(x), but the returned list is decomposed into indices
  2514.      according to the dimensions of x.  The returned list is always
  2515.      2 dimensional, with the second dimension the same as the dimension
  2516.      of where(x).  The first dimension has length corresponding to the
  2517.      number of dimensions of x.  Thus, where2([[0,1,3],[2,0,4]]) would
  2518.      return [[2,1],[3,1],[1,2],[3,2]].
  2519.      If noneof(x), where2 returns [] (i.e.- nil).
  2520.   SEE ALSO: where, merge, merge2, allof, anyof, noneof, nallof, sort
  2521.  */
  2522.  
  2523.                                                                       write
  2524. /* DOCUMENT n= write(f, format=fstring, linesize=l, obj1, obj2, ...)
  2525.             n= write(format=fstring, linesize=l, obj1, obj2, ...)
  2526.      or strings= swrite(format=fstring, linesize=l, obj1, obj2, ...)
  2527.      writes text to I/O stream F (1st form), or to the terminal (2nd
  2528.      form), or to the STRINGS string array (3rd form), representing
  2529.      arrays OBJ1, OBJ2, ..., according to the optional FSTRING.  The
  2530.      optional linesize L defaults to 80 characters, and helps restrict
  2531.      line lengths when FSTRING is not given, or does not contain
  2532.      newline directives.  The write function always appends to the
  2533.      end of a text file; the position for a sequence of reads is
  2534.      not affected by intervening writes.
  2535.  
  2536.      There must be one conversion specifier (see below) in FSTRING for
  2537.      each OBJ to be written; the type of the conversion specifier must
  2538.      generally match the type of the OBJ.  That is, an integer OBJ
  2539.      requires an integer specifier (d, i, o, u, x, or c) in FSTRING,
  2540.      a real OBJ requires a real specifier (e, f, or g), a string OBJ
  2541.      requires the string specifier (s), and a pointer OBJ requires a
  2542.      the pointer specifier (p).  An OBJ may not be complex, a structure
  2543.      instance, or any non-array Yorick object.  If FSTRING is not
  2544.      supplied, or if it has fewer conversion specifiers than the
  2545.      number of OBJ arguments, then Yorick supplies default specifiers
  2546.      (" %8ld" for integers, " %14.6lg" for reals, " %s" for strings, and
  2547.      " %8p" for pointers).  If FSTRING contains more specifiers than
  2548.      there are OBJ arguments, the part of FSTRING beginning with the
  2549.      first specifier with no OBJ is ignored.
  2550.  
  2551.      The OBJ may be scalar or arrays, but the dimensions of the OBJ
  2552.      must be conformable.  If the OBJ are arrays, Yorick behaves as
  2553.      if he write were called in a loop dimsof(OBJ1, OBJ2, ...) times,
  2554.      writing one array element of each of the OBJ according to FSTRING
  2555.      on each pass through the loop.  The swrite function returns a
  2556.      string array with dimensions dimsof(OBJ1, OBJ2, ...).  The write
  2557.      function inserts a newline between passes through the array if
  2558.      the line produced by the previous pass did not end with a
  2559.      newline, and if the total number of characters output since the
  2560.      previous inserted newline, plus the number of characters about
  2561.      to be written on the current pass, would exceed L characters
  2562.      (L defaults to 80).  The write function returns the total
  2563.      number of characters output.
  2564.  
  2565.      The FSTRING is composed of a series of "directives" which are
  2566.  
  2567.                                                FROM write TO xdr_primitives
  2568.  
  2569.      (1) characters other than % -- copied directly to output
  2570.      (2) conversion specifiers beginning with % and ending with a
  2571.          character specifying the type of conversion -- specify
  2572.      how to convert an OBJ into characters for output
  2573.      The conversion specifier is of the form %FW.PSC, where:
  2574.      F is zero or more optional flags:
  2575.        - left justify in field width
  2576.        + signed conversion will begin with either + or -
  2577.          (space) signed conversion  will begin with either space or -
  2578.        # alternate form (see description of each type below)
  2579.        0 pad field width with leading 0s instead of leading spaces
  2580.      W is either a decimal integer specifying the minimum field width
  2581.        (padded as specified by flags), or not present to use the
  2582.        minimum number of characters required.
  2583.      .P is either a decimal integer specifying the precision of the
  2584.        result, or not present to get the default.  For integers, this
  2585.        is the number of digits to be printed (possibly forcing leading
  2586.        zeroes), and defaults to 1.  For reals, this is the number of
  2587.        digits after the decimal point, and defaults to 6.  For strings,
  2588.        this is the maximum number of characters to print, and defaults
  2589.        to infinity.
  2590.      S is either one of the characters 'h', 'l', or 'L', or not
  2591.        present.  Yorick allows this for compatibility with the C
  2592.        library functions, but ignores it.
  2593.      C is a character specifying the type of conversion:
  2594.        d, i  - decimal integer
  2595.        o     - octal integer (# forces leading 0)
  2596.        u     - unsigned decimal integer (same as d for Yorick)
  2597.        x, X            - hex integer (# forces leading 0x)
  2598.        f     - floating point real in fixed point notation
  2599.                (# forces decimal)
  2600.        e, E  - floating point real in scientific notation
  2601.        g, G  - floating point real in fixed or scientific notation
  2602.                depending on the value converted (# forces decimal)
  2603.        s   - string of ASCII characters
  2604.        c   - integer printed as corresponding ASCII character
  2605.        p   - pointer
  2606.        %   - the ordinary % character; complete conversion
  2607.              specification must be "%%"
  2608.  
  2609.      The write function is modeled on the ANSI standard C library
  2610.      fprintf and sprintf functions, but differs in several respects:
  2611.        (1) Yorick's write cannot handle the %n conversion specifier
  2612.            in FSTRING.
  2613.        (2) Yorick's write may insert additional newlines if the OBJ
  2614.            are arrays, to avoid extremely long output lines.
  2615.    SEE ALSO: print, exit, error, read, rdline, open, close, save, restore
  2616.  */
  2617.  
  2618.                                                              xdr_primitives
  2619. /* DOCUMENT xdr_primitives, file
  2620.      sets FILE primitive data types to be XDR (external data representation).
  2621.  */
  2622.  
  2623.                                                  FROM yorick_stats TO zncen
  2624.  
  2625.                                                                yorick_stats
  2626. /* DOCUMENT yorick_stats
  2627.      returns an array of longs describing Yorick memory usage.
  2628.      For debugging.  See ydata.c source code.
  2629.  */
  2630.  
  2631.                                                                       zncen
  2632. /* DOCUMENT zncen(ptcen)
  2633.          or zncen(ptcen, ireg)
  2634.      returns zone centered version of the 2-D point centered array PTCEN.
  2635.      The result is (imax-1)-by-(jmax-1) if PTCEN is imax-by-jmax.
  2636.      If the region number array IREG is specified, zones with region
  2637.      number 0 are not included in the point centering operation.
  2638.      Note that IREG should have dimensions imax-by-jmax, like
  2639.      the input PTCEN array; the first row and column of IREG are ignored.
  2640.      Without IREG, zncen(ptcen) is equivalent to ptcen(zcen,zcen).
  2641.   SEE ALSO: ptcen, uncen
  2642.  */
  2643.